@elastic/eui 76.1.0 → 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 +33 -6
- package/dist/eui_theme_dark.min.css +1 -1
- package/dist/eui_theme_light.css +33 -6
- package/dist/eui_theme_light.min.css +1 -1
- package/es/components/avatar/avatar.js +1 -1
- package/es/components/badge/badge.js +1 -1
- package/es/components/badge/beta_badge/beta_badge.js +1 -1
- package/es/components/basic_table/basic_table.js +1 -1
- package/es/components/basic_table/collapsed_item_actions.js +1 -1
- package/es/components/basic_table/in_memory_table.js +1 -1
- package/es/components/button/_button_content_deprecated.js +1 -1
- package/es/components/button/button_display/_button_display.js +1 -1
- package/es/components/button/button_display/_button_display_content.js +1 -1
- package/es/components/button/button_empty/button_empty.js +1 -1
- package/es/components/button/button_group/button_group.js +1 -1
- package/es/components/button/button_group/button_group_button.js +1 -1
- package/es/components/button/button_icon/button_icon.js +1 -1
- package/es/components/call_out/call_out.js +1 -1
- package/es/components/card/card.js +1 -1
- package/es/components/collapsible_nav/collapsible_nav_group/collapsible_nav_group.js +1 -1
- package/es/components/comment_list/comment.js +2 -2
- package/es/components/comment_list/comment_event.js +1 -1
- package/es/components/comment_list/comment_list.js +2 -2
- package/es/components/comment_list/comment_timeline.js +1 -1
- package/es/components/datagrid/body/data_grid_body.js +32 -408
- 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 +34 -33
- package/es/components/datagrid/body/data_grid_cell_wrapper.js +132 -0
- package/es/components/datagrid/body/header/data_grid_header_cell.js +12 -12
- package/es/components/datagrid/body/header/data_grid_header_row.js +16 -15
- package/es/components/datagrid/controls/column_sorting_draggable.js +1 -1
- package/es/components/datagrid/data_grid.js +34 -18
- package/es/components/datagrid/data_grid_types.js +18 -1
- package/es/components/datagrid/utils/in_memory.js +12 -12
- package/es/components/datagrid/utils/row_heights.js +111 -31
- package/es/components/date_picker/date_picker.js +2 -2
- package/es/components/date_picker/date_picker_range.js +1 -1
- package/es/components/empty_prompt/empty_prompt.js +1 -1
- package/es/components/facet/facet_button.js +1 -1
- package/es/components/form/field_number/field_number.js +1 -1
- package/es/components/form/field_text/field_text.js +2 -2
- package/es/components/form/form_control_layout/form_control_layout.js +2 -2
- package/es/components/form/form_control_layout/form_control_layout_custom_icon.js +1 -1
- package/es/components/form/form_control_layout/form_control_layout_icons.js +2 -2
- package/es/components/header/header_links/header_link.js +1 -1
- package/es/components/header/header_links/header_links.js +1 -1
- package/es/components/header/header_logo.js +1 -1
- package/es/components/icon/icon.js +1 -1
- package/es/components/icon/icon_map.js +2 -0
- package/es/components/key_pad_menu/key_pad_menu_item.js +1 -1
- package/es/components/list_group/list_group.js +2 -2
- package/es/components/list_group/list_group_item.js +2 -2
- package/es/components/list_group/list_group_item_extra_action.js +1 -1
- package/es/components/list_group/pinnable_list_group/pinnable_list_group.js +4 -4
- package/es/components/loading/loading_logo.js +1 -1
- package/es/components/markdown_editor/markdown_editor.js +1 -1
- package/es/components/markdown_editor/markdown_editor_drop_zone.js +1 -1
- package/es/components/markdown_editor/markdown_editor_footer.js +1 -1
- package/es/components/markdown_editor/markdown_editor_toolbar.js +1 -1
- package/es/components/notification/notification_event.js +2 -2
- package/es/components/notification/notification_event_meta.js +1 -1
- package/es/components/page/page_header/page_header_content.js +1 -1
- package/es/components/pagination/pagination_button.js +1 -1
- package/es/components/selectable/selectable_list/selectable_list.js +1 -1
- package/es/components/selectable/selectable_list/selectable_list_item.js +1 -1
- package/es/components/selectable/selectable_templates/selectable_template_sitewide.js +1 -1
- package/es/components/suggest/suggest.js +1 -1
- package/es/components/suggest/suggest_item.js +1 -1
- package/es/components/table/table_header_button.js +1 -1
- package/es/components/timeline/timeline_item_icon.js +1 -1
- package/es/components/toast/global_toast_list.js +1 -1
- package/es/components/toast/toast.js +1 -1
- package/es/components/tool_tip/icon_tip.js +1 -1
- package/eui.d.ts +229 -136
- package/i18ntokens.json +8 -8
- package/lib/components/avatar/avatar.js +1 -1
- package/lib/components/badge/badge.js +1 -1
- package/lib/components/badge/beta_badge/beta_badge.js +1 -1
- package/lib/components/basic_table/basic_table.js +1 -1
- package/lib/components/basic_table/collapsed_item_actions.js +1 -1
- package/lib/components/basic_table/in_memory_table.js +1 -1
- package/lib/components/button/_button_content_deprecated.js +1 -1
- package/lib/components/button/button_display/_button_display.js +1 -1
- package/lib/components/button/button_display/_button_display_content.js +1 -1
- package/lib/components/button/button_empty/button_empty.js +1 -1
- package/lib/components/button/button_group/button_group.js +1 -1
- package/lib/components/button/button_group/button_group_button.js +1 -1
- package/lib/components/button/button_icon/button_icon.js +1 -1
- package/lib/components/call_out/call_out.js +1 -1
- package/lib/components/card/card.js +1 -1
- package/lib/components/collapsible_nav/collapsible_nav_group/collapsible_nav_group.js +1 -1
- package/lib/components/comment_list/comment.js +2 -2
- package/lib/components/comment_list/comment_event.js +1 -1
- package/lib/components/comment_list/comment_list.js +2 -2
- package/lib/components/comment_list/comment_timeline.js +1 -1
- package/lib/components/datagrid/body/data_grid_body.js +32 -429
- 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 +34 -33
- package/lib/components/datagrid/body/data_grid_cell_wrapper.js +147 -0
- package/lib/components/datagrid/body/header/data_grid_header_cell.js +12 -12
- package/lib/components/datagrid/body/header/data_grid_header_row.js +17 -15
- package/lib/components/datagrid/controls/column_sorting_draggable.js +1 -1
- package/lib/components/datagrid/data_grid.js +34 -17
- package/lib/components/datagrid/data_grid_types.js +22 -1
- package/lib/components/datagrid/utils/in_memory.js +12 -12
- package/lib/components/datagrid/utils/row_heights.js +116 -33
- package/lib/components/date_picker/date_picker.js +2 -2
- package/lib/components/date_picker/date_picker_range.js +1 -1
- package/lib/components/empty_prompt/empty_prompt.js +1 -1
- package/lib/components/facet/facet_button.js +1 -1
- package/lib/components/form/field_number/field_number.js +1 -1
- package/lib/components/form/field_text/field_text.js +2 -2
- package/lib/components/form/form_control_layout/form_control_layout.js +2 -2
- package/lib/components/form/form_control_layout/form_control_layout_custom_icon.js +1 -1
- package/lib/components/form/form_control_layout/form_control_layout_icons.js +2 -2
- package/lib/components/header/header_links/header_link.js +1 -1
- package/lib/components/header/header_links/header_links.js +1 -1
- package/lib/components/header/header_logo.js +1 -1
- package/lib/components/icon/icon.js +1 -1
- package/lib/components/icon/icon_map.js +2 -0
- package/lib/components/key_pad_menu/key_pad_menu_item.js +1 -1
- package/lib/components/list_group/list_group.js +2 -2
- package/lib/components/list_group/list_group_item.js +2 -2
- package/lib/components/list_group/list_group_item_extra_action.js +1 -1
- package/lib/components/list_group/pinnable_list_group/pinnable_list_group.js +4 -4
- package/lib/components/loading/loading_logo.js +1 -1
- package/lib/components/markdown_editor/markdown_editor.js +1 -1
- package/lib/components/markdown_editor/markdown_editor_drop_zone.js +1 -1
- package/lib/components/markdown_editor/markdown_editor_footer.js +1 -1
- package/lib/components/markdown_editor/markdown_editor_toolbar.js +1 -1
- package/lib/components/notification/notification_event.js +2 -2
- package/lib/components/notification/notification_event_meta.js +1 -1
- package/lib/components/page/page_header/page_header_content.js +1 -1
- package/lib/components/selectable/selectable_list/selectable_list.js +1 -1
- package/lib/components/selectable/selectable_list/selectable_list_item.js +1 -1
- package/lib/components/selectable/selectable_templates/selectable_template_sitewide.js +1 -1
- package/lib/components/suggest/suggest.js +1 -1
- package/lib/components/suggest/suggest_item.js +1 -1
- package/lib/components/table/table_header_button.js +1 -1
- package/lib/components/timeline/timeline_item_icon.js +1 -1
- package/lib/components/toast/global_toast_list.js +1 -1
- package/lib/components/toast/toast.js +1 -1
- package/lib/components/tool_tip/icon_tip.js +1 -1
- 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 +8 -7
- 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/icon/icon_map.js +2 -0
- 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 +8 -7
- 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/icon/icon_map.js +2 -0
- 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/selectable/selectable_list/_selectable_list.scss +10 -3
- package/src/themes/amsterdam/global_styling/mixins/_states.scss +17 -8
- package/test-env/components/avatar/avatar.js +1 -1
- package/test-env/components/badge/badge.js +1 -1
- package/test-env/components/badge/beta_badge/beta_badge.js +1 -1
- package/test-env/components/basic_table/basic_table.js +1 -1
- package/test-env/components/basic_table/collapsed_item_actions.js +1 -1
- package/test-env/components/basic_table/in_memory_table.js +1 -1
- package/test-env/components/button/_button_content_deprecated.js +1 -1
- package/test-env/components/button/button_display/_button_display.js +1 -1
- package/test-env/components/button/button_display/_button_display_content.js +1 -1
- package/test-env/components/button/button_empty/button_empty.js +1 -1
- package/test-env/components/button/button_group/button_group.js +1 -1
- package/test-env/components/button/button_group/button_group_button.js +1 -1
- package/test-env/components/button/button_icon/button_icon.js +1 -1
- package/test-env/components/call_out/call_out.js +1 -1
- package/test-env/components/card/card.js +1 -1
- package/test-env/components/collapsible_nav/collapsible_nav_group/collapsible_nav_group.js +1 -1
- package/test-env/components/comment_list/comment.js +2 -2
- package/test-env/components/comment_list/comment_event.js +1 -1
- package/test-env/components/comment_list/comment_list.js +2 -2
- package/test-env/components/comment_list/comment_timeline.js +1 -1
- package/test-env/components/datagrid/body/data_grid_body.js +31 -428
- 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 +34 -33
- package/test-env/components/datagrid/body/data_grid_cell_wrapper.js +144 -0
- package/test-env/components/datagrid/body/header/data_grid_header_cell.js +12 -12
- package/test-env/components/datagrid/body/header/data_grid_header_row.js +17 -15
- package/test-env/components/datagrid/controls/column_sorting_draggable.js +1 -1
- package/test-env/components/datagrid/data_grid.js +34 -17
- package/test-env/components/datagrid/data_grid_types.js +22 -1
- package/test-env/components/datagrid/utils/in_memory.js +12 -12
- package/test-env/components/datagrid/utils/row_heights.js +103 -37
- package/test-env/components/date_picker/date_picker.js +2 -2
- package/test-env/components/date_picker/date_picker_range.js +1 -1
- package/test-env/components/empty_prompt/empty_prompt.js +1 -1
- package/test-env/components/facet/facet_button.js +1 -1
- package/test-env/components/form/field_number/field_number.js +1 -1
- package/test-env/components/form/field_text/field_text.js +2 -2
- package/test-env/components/form/form_control_layout/form_control_layout.js +2 -2
- package/test-env/components/form/form_control_layout/form_control_layout_custom_icon.js +1 -1
- package/test-env/components/form/form_control_layout/form_control_layout_icons.js +2 -2
- package/test-env/components/header/header_links/header_link.js +1 -1
- package/test-env/components/header/header_links/header_links.js +1 -1
- package/test-env/components/header/header_logo.js +1 -1
- package/test-env/components/icon/icon_map.js +2 -0
- package/test-env/components/key_pad_menu/key_pad_menu_item.js +1 -1
- package/test-env/components/list_group/list_group.js +2 -2
- package/test-env/components/list_group/list_group_item.js +2 -2
- package/test-env/components/list_group/list_group_item_extra_action.js +1 -1
- package/test-env/components/list_group/pinnable_list_group/pinnable_list_group.js +4 -4
- package/test-env/components/loading/loading_logo.js +1 -1
- package/test-env/components/markdown_editor/markdown_editor.js +1 -1
- package/test-env/components/markdown_editor/markdown_editor_drop_zone.js +1 -1
- package/test-env/components/markdown_editor/markdown_editor_footer.js +1 -1
- package/test-env/components/markdown_editor/markdown_editor_toolbar.js +1 -1
- package/test-env/components/notification/notification_event.js +2 -2
- package/test-env/components/notification/notification_event_meta.js +1 -1
- package/test-env/components/page/page_header/page_header_content.js +1 -1
- package/test-env/components/selectable/selectable_list/selectable_list.js +1 -1
- package/test-env/components/selectable/selectable_list/selectable_list_item.js +1 -1
- package/test-env/components/selectable/selectable_templates/selectable_template_sitewide.js +1 -1
- package/test-env/components/suggest/suggest.js +1 -1
- package/test-env/components/suggest/suggest_item.js +1 -1
- package/test-env/components/table/table_header_button.js +1 -1
- package/test-env/components/timeline/timeline_item_icon.js +1 -1
- package/test-env/components/toast/global_toast_list.js +1 -1
- package/test-env/components/toast/toast.js +1 -1
- package/test-env/components/tool_tip/icon_tip.js +1 -1
|
@@ -0,0 +1,311 @@
|
|
|
1
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
2
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
3
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
4
|
+
var _excluded = ["children", "style"];
|
|
5
|
+
|
|
6
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
7
|
+
|
|
8
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
9
|
+
|
|
10
|
+
/*
|
|
11
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
12
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
13
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
14
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
15
|
+
* Side Public License, v 1.
|
|
16
|
+
*/
|
|
17
|
+
import classNames from 'classnames';
|
|
18
|
+
import React, { forwardRef, createContext, useContext, useEffect, useRef } from 'react';
|
|
19
|
+
import { VariableSizeGrid as Grid } from 'react-window';
|
|
20
|
+
import { useResizeObserver } from '../../observer/resize_observer';
|
|
21
|
+
import { useDataGridHeader } from './header';
|
|
22
|
+
import { useDataGridFooter } from './footer';
|
|
23
|
+
import { Cell } from './data_grid_cell_wrapper';
|
|
24
|
+
import { useRowManager } from './data_grid_row_manager';
|
|
25
|
+
import { useFinalGridDimensions, useUnconstrainedHeight, useVirtualizeContainerWidth } from '../utils/grid_height_width';
|
|
26
|
+
import { useDefaultColumnWidth, useColumnWidths } from '../utils/col_widths';
|
|
27
|
+
import { useRowHeightUtils, useDefaultRowHeight } from '../utils/row_heights';
|
|
28
|
+
import { useScrollBars, useScroll } from '../utils/scrolling';
|
|
29
|
+
import { IS_JEST_ENVIRONMENT } from '../../../utils';
|
|
30
|
+
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
31
|
+
export var _Cell = function _Cell(_ref) {
|
|
32
|
+
var columnIndex = _ref.columnIndex,
|
|
33
|
+
rowIndex = _ref.rowIndex,
|
|
34
|
+
style = _ref.style,
|
|
35
|
+
data = _ref.data;
|
|
36
|
+
|
|
37
|
+
var _useContext = useContext(DataGridWrapperRowsContext),
|
|
38
|
+
headerRowHeight = _useContext.headerRowHeight;
|
|
39
|
+
|
|
40
|
+
return ___EmotionJSX(Cell, _extends({
|
|
41
|
+
colIndex: columnIndex,
|
|
42
|
+
visibleRowIndex: rowIndex,
|
|
43
|
+
style: _objectSpread(_objectSpread({}, style), {}, {
|
|
44
|
+
top: "".concat(parseFloat(style.top) + headerRowHeight, "px")
|
|
45
|
+
})
|
|
46
|
+
}, data));
|
|
47
|
+
}; // Context is required to pass props to react-window's innerElementType
|
|
48
|
+
// @see https://github.com/bvaughn/react-window/issues/404
|
|
49
|
+
|
|
50
|
+
export var DataGridWrapperRowsContext = /*#__PURE__*/createContext({
|
|
51
|
+
headerRow: ___EmotionJSX("div", null),
|
|
52
|
+
headerRowHeight: 0,
|
|
53
|
+
footerRow: null
|
|
54
|
+
});
|
|
55
|
+
var InnerElement = /*#__PURE__*/forwardRef(function (_ref2, ref) {
|
|
56
|
+
var children = _ref2.children,
|
|
57
|
+
style = _ref2.style,
|
|
58
|
+
rest = _objectWithoutProperties(_ref2, _excluded);
|
|
59
|
+
|
|
60
|
+
var _useContext2 = useContext(DataGridWrapperRowsContext),
|
|
61
|
+
headerRowHeight = _useContext2.headerRowHeight,
|
|
62
|
+
headerRow = _useContext2.headerRow,
|
|
63
|
+
footerRow = _useContext2.footerRow;
|
|
64
|
+
|
|
65
|
+
return ___EmotionJSX(React.Fragment, null, ___EmotionJSX("div", _extends({
|
|
66
|
+
ref: ref,
|
|
67
|
+
style: _objectSpread(_objectSpread({}, style), {}, {
|
|
68
|
+
height: style.height + headerRowHeight
|
|
69
|
+
})
|
|
70
|
+
}, rest), headerRow, children), footerRow);
|
|
71
|
+
});
|
|
72
|
+
InnerElement.displayName = 'EuiDataGridInnerElement';
|
|
73
|
+
export var EuiDataGridBodyVirtualized = function EuiDataGridBodyVirtualized(_ref3) {
|
|
74
|
+
var leadingControlColumns = _ref3.leadingControlColumns,
|
|
75
|
+
trailingControlColumns = _ref3.trailingControlColumns,
|
|
76
|
+
columns = _ref3.columns,
|
|
77
|
+
visibleColCount = _ref3.visibleColCount,
|
|
78
|
+
schema = _ref3.schema,
|
|
79
|
+
schemaDetectors = _ref3.schemaDetectors,
|
|
80
|
+
rowCount = _ref3.rowCount,
|
|
81
|
+
_ref3$visibleRows = _ref3.visibleRows,
|
|
82
|
+
startRow = _ref3$visibleRows.startRow,
|
|
83
|
+
endRow = _ref3$visibleRows.endRow,
|
|
84
|
+
visibleRowCount = _ref3$visibleRows.visibleRowCount,
|
|
85
|
+
renderCellValue = _ref3.renderCellValue,
|
|
86
|
+
renderCellPopover = _ref3.renderCellPopover,
|
|
87
|
+
renderFooterCellValue = _ref3.renderFooterCellValue,
|
|
88
|
+
interactiveCellId = _ref3.interactiveCellId,
|
|
89
|
+
pagination = _ref3.pagination,
|
|
90
|
+
headerIsInteractive = _ref3.headerIsInteractive,
|
|
91
|
+
handleHeaderMutation = _ref3.handleHeaderMutation,
|
|
92
|
+
setVisibleColumns = _ref3.setVisibleColumns,
|
|
93
|
+
switchColumnPos = _ref3.switchColumnPos,
|
|
94
|
+
onColumnResize = _ref3.onColumnResize,
|
|
95
|
+
rowHeightsOptions = _ref3.rowHeightsOptions,
|
|
96
|
+
virtualizationOptions = _ref3.virtualizationOptions,
|
|
97
|
+
isFullScreen = _ref3.isFullScreen,
|
|
98
|
+
gridStyles = _ref3.gridStyles,
|
|
99
|
+
gridWidth = _ref3.gridWidth,
|
|
100
|
+
gridRef = _ref3.gridRef,
|
|
101
|
+
gridItemsRendered = _ref3.gridItemsRendered,
|
|
102
|
+
wrapperRef = _ref3.wrapperRef;
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Grid refs & observers
|
|
106
|
+
*/
|
|
107
|
+
var wrapperDimensions = useResizeObserver(wrapperRef.current);
|
|
108
|
+
var outerGridRef = useRef(null); // container that becomes scrollable
|
|
109
|
+
|
|
110
|
+
var innerGridRef = useRef(null); // container sized to fit all content
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Scroll bars
|
|
114
|
+
*/
|
|
115
|
+
|
|
116
|
+
var _useScrollBars = useScrollBars(outerGridRef, gridStyles.border),
|
|
117
|
+
scrollBarHeight = _useScrollBars.scrollBarHeight,
|
|
118
|
+
hasVerticalScroll = _useScrollBars.hasVerticalScroll,
|
|
119
|
+
hasHorizontalScroll = _useScrollBars.hasHorizontalScroll,
|
|
120
|
+
scrollBorderOverlay = _useScrollBars.scrollBorderOverlay;
|
|
121
|
+
/**
|
|
122
|
+
* Widths
|
|
123
|
+
*/
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
var virtualizeContainerWidth = useVirtualizeContainerWidth(outerGridRef.current, gridWidth, pagination === null || pagination === void 0 ? void 0 : pagination.pageSize); // compute the default column width from the container's width and count of visible columns
|
|
127
|
+
|
|
128
|
+
var defaultColumnWidth = useDefaultColumnWidth(virtualizeContainerWidth, leadingControlColumns, trailingControlColumns, columns);
|
|
129
|
+
|
|
130
|
+
var _useColumnWidths = useColumnWidths({
|
|
131
|
+
columns: columns,
|
|
132
|
+
leadingControlColumns: leadingControlColumns,
|
|
133
|
+
trailingControlColumns: trailingControlColumns,
|
|
134
|
+
defaultColumnWidth: defaultColumnWidth,
|
|
135
|
+
onColumnResize: onColumnResize
|
|
136
|
+
}),
|
|
137
|
+
columnWidths = _useColumnWidths.columnWidths,
|
|
138
|
+
setColumnWidth = _useColumnWidths.setColumnWidth,
|
|
139
|
+
getColumnWidth = _useColumnWidths.getColumnWidth;
|
|
140
|
+
/**
|
|
141
|
+
* Header & footer
|
|
142
|
+
*/
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
var _useDataGridHeader = useDataGridHeader({
|
|
146
|
+
headerIsInteractive: headerIsInteractive,
|
|
147
|
+
handleHeaderMutation: handleHeaderMutation,
|
|
148
|
+
switchColumnPos: switchColumnPos,
|
|
149
|
+
setVisibleColumns: setVisibleColumns,
|
|
150
|
+
leadingControlColumns: leadingControlColumns,
|
|
151
|
+
trailingControlColumns: trailingControlColumns,
|
|
152
|
+
columns: columns,
|
|
153
|
+
columnWidths: columnWidths,
|
|
154
|
+
defaultColumnWidth: defaultColumnWidth,
|
|
155
|
+
setColumnWidth: setColumnWidth,
|
|
156
|
+
schema: schema,
|
|
157
|
+
schemaDetectors: schemaDetectors
|
|
158
|
+
}),
|
|
159
|
+
headerRow = _useDataGridHeader.headerRow,
|
|
160
|
+
headerRowHeight = _useDataGridHeader.headerRowHeight;
|
|
161
|
+
|
|
162
|
+
var _useDataGridFooter = useDataGridFooter({
|
|
163
|
+
renderFooterCellValue: renderFooterCellValue,
|
|
164
|
+
renderCellPopover: renderCellPopover,
|
|
165
|
+
rowIndex: visibleRowCount,
|
|
166
|
+
visibleRowIndex: visibleRowCount,
|
|
167
|
+
interactiveCellId: interactiveCellId,
|
|
168
|
+
leadingControlColumns: leadingControlColumns,
|
|
169
|
+
trailingControlColumns: trailingControlColumns,
|
|
170
|
+
columns: columns,
|
|
171
|
+
columnWidths: columnWidths,
|
|
172
|
+
defaultColumnWidth: defaultColumnWidth,
|
|
173
|
+
schema: schema
|
|
174
|
+
}),
|
|
175
|
+
footerRow = _useDataGridFooter.footerRow,
|
|
176
|
+
footerRowHeight = _useDataGridFooter.footerRowHeight;
|
|
177
|
+
/**
|
|
178
|
+
* Handle scrolling cells fully into view
|
|
179
|
+
*/
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
useScroll({
|
|
183
|
+
gridRef: gridRef,
|
|
184
|
+
outerGridRef: outerGridRef,
|
|
185
|
+
hasGridScrolling: hasVerticalScroll || hasHorizontalScroll,
|
|
186
|
+
headerRowHeight: headerRowHeight,
|
|
187
|
+
footerRowHeight: footerRowHeight,
|
|
188
|
+
visibleRowCount: visibleRowCount,
|
|
189
|
+
hasStickyFooter: !!(renderFooterCellValue && gridStyles.stickyFooter)
|
|
190
|
+
});
|
|
191
|
+
/**
|
|
192
|
+
* Row manager
|
|
193
|
+
*/
|
|
194
|
+
|
|
195
|
+
var rowManager = useRowManager({
|
|
196
|
+
innerGridRef: innerGridRef,
|
|
197
|
+
rowClasses: gridStyles.rowClasses
|
|
198
|
+
});
|
|
199
|
+
/**
|
|
200
|
+
* Heights
|
|
201
|
+
*/
|
|
202
|
+
|
|
203
|
+
var rowHeightUtils = useRowHeightUtils({
|
|
204
|
+
virtualization: {
|
|
205
|
+
gridRef: gridRef,
|
|
206
|
+
outerGridElementRef: outerGridRef,
|
|
207
|
+
gridItemsRenderedRef: gridItemsRendered
|
|
208
|
+
},
|
|
209
|
+
rowHeightsOptions: rowHeightsOptions,
|
|
210
|
+
gridStyles: gridStyles,
|
|
211
|
+
columns: columns
|
|
212
|
+
});
|
|
213
|
+
|
|
214
|
+
var _useDefaultRowHeight = useDefaultRowHeight({
|
|
215
|
+
rowHeightsOptions: rowHeightsOptions,
|
|
216
|
+
rowHeightUtils: rowHeightUtils
|
|
217
|
+
}),
|
|
218
|
+
defaultRowHeight = _useDefaultRowHeight.defaultRowHeight,
|
|
219
|
+
setRowHeight = _useDefaultRowHeight.setRowHeight,
|
|
220
|
+
getRowHeight = _useDefaultRowHeight.getRowHeight;
|
|
221
|
+
|
|
222
|
+
var unconstrainedHeight = useUnconstrainedHeight({
|
|
223
|
+
rowHeightUtils: rowHeightUtils,
|
|
224
|
+
startRow: startRow,
|
|
225
|
+
endRow: endRow,
|
|
226
|
+
rowHeightsOptions: rowHeightsOptions,
|
|
227
|
+
defaultRowHeight: defaultRowHeight,
|
|
228
|
+
headerRowHeight: headerRowHeight,
|
|
229
|
+
footerRowHeight: footerRowHeight,
|
|
230
|
+
scrollBarHeight: scrollBarHeight,
|
|
231
|
+
innerGridRef: innerGridRef
|
|
232
|
+
});
|
|
233
|
+
/**
|
|
234
|
+
* Final grid height & width
|
|
235
|
+
*/
|
|
236
|
+
|
|
237
|
+
var _useFinalGridDimensio = useFinalGridDimensions({
|
|
238
|
+
unconstrainedHeight: unconstrainedHeight,
|
|
239
|
+
unconstrainedWidth: 0,
|
|
240
|
+
// unable to determine this until the container's size is known
|
|
241
|
+
wrapperDimensions: wrapperDimensions,
|
|
242
|
+
wrapperRef: wrapperRef,
|
|
243
|
+
isFullScreen: isFullScreen,
|
|
244
|
+
rowCount: rowCount
|
|
245
|
+
}),
|
|
246
|
+
finalWidth = _useFinalGridDimensio.finalWidth,
|
|
247
|
+
finalHeight = _useFinalGridDimensio.finalHeight;
|
|
248
|
+
/**
|
|
249
|
+
* Grid resets
|
|
250
|
+
*/
|
|
251
|
+
|
|
252
|
+
|
|
253
|
+
useEffect(function () {
|
|
254
|
+
if (gridRef.current) {
|
|
255
|
+
gridRef.current.resetAfterColumnIndex(0);
|
|
256
|
+
}
|
|
257
|
+
}, [gridRef, columns, columnWidths, defaultColumnWidth]);
|
|
258
|
+
useEffect(function () {
|
|
259
|
+
if (gridRef.current && rowHeightsOptions) {
|
|
260
|
+
gridRef.current.resetAfterRowIndex(0);
|
|
261
|
+
}
|
|
262
|
+
}, [gridRef, pagination === null || pagination === void 0 ? void 0 : pagination.pageIndex, rowHeightsOptions, gridStyles === null || gridStyles === void 0 ? void 0 : gridStyles.cellPadding, gridStyles === null || gridStyles === void 0 ? void 0 : gridStyles.fontSize]);
|
|
263
|
+
useEffect(function () {
|
|
264
|
+
if (gridRef.current) {
|
|
265
|
+
gridRef.current.resetAfterRowIndex(0);
|
|
266
|
+
}
|
|
267
|
+
}, [gridRef, getRowHeight]);
|
|
268
|
+
return IS_JEST_ENVIRONMENT || finalWidth > 0 ? ___EmotionJSX(DataGridWrapperRowsContext.Provider, {
|
|
269
|
+
value: {
|
|
270
|
+
headerRowHeight: headerRowHeight,
|
|
271
|
+
headerRow: headerRow,
|
|
272
|
+
footerRow: footerRow
|
|
273
|
+
}
|
|
274
|
+
}, ___EmotionJSX(Grid, _extends({}, virtualizationOptions ? virtualizationOptions : {}, {
|
|
275
|
+
ref: gridRef,
|
|
276
|
+
className: classNames('euiDataGrid__virtualized', virtualizationOptions === null || virtualizationOptions === void 0 ? void 0 : virtualizationOptions.className),
|
|
277
|
+
onItemsRendered: function onItemsRendered(itemsRendered) {
|
|
278
|
+
var _virtualizationOption;
|
|
279
|
+
|
|
280
|
+
gridItemsRendered.current = itemsRendered;
|
|
281
|
+
virtualizationOptions === null || virtualizationOptions === void 0 ? void 0 : (_virtualizationOption = virtualizationOptions.onItemsRendered) === null || _virtualizationOption === void 0 ? void 0 : _virtualizationOption.call(virtualizationOptions, itemsRendered);
|
|
282
|
+
},
|
|
283
|
+
innerElementType: InnerElement,
|
|
284
|
+
outerRef: outerGridRef,
|
|
285
|
+
innerRef: innerGridRef,
|
|
286
|
+
columnCount: visibleColCount,
|
|
287
|
+
width: finalWidth,
|
|
288
|
+
columnWidth: getColumnWidth,
|
|
289
|
+
height: finalHeight,
|
|
290
|
+
rowHeight: getRowHeight,
|
|
291
|
+
itemData: {
|
|
292
|
+
schemaDetectors: schemaDetectors,
|
|
293
|
+
setRowHeight: setRowHeight,
|
|
294
|
+
leadingControlColumns: leadingControlColumns,
|
|
295
|
+
trailingControlColumns: trailingControlColumns,
|
|
296
|
+
columns: columns,
|
|
297
|
+
visibleColCount: visibleColCount,
|
|
298
|
+
schema: schema,
|
|
299
|
+
columnWidths: columnWidths,
|
|
300
|
+
defaultColumnWidth: defaultColumnWidth,
|
|
301
|
+
renderCellValue: renderCellValue,
|
|
302
|
+
renderCellPopover: renderCellPopover,
|
|
303
|
+
interactiveCellId: interactiveCellId,
|
|
304
|
+
rowHeightsOptions: rowHeightsOptions,
|
|
305
|
+
rowHeightUtils: rowHeightUtils,
|
|
306
|
+
rowManager: rowManager,
|
|
307
|
+
pagination: pagination
|
|
308
|
+
},
|
|
309
|
+
rowCount: IS_JEST_ENVIRONMENT || headerRowHeight > 0 ? visibleRowCount : 0
|
|
310
|
+
}), _Cell), scrollBorderOverlay) : null;
|
|
311
|
+
};
|
|
@@ -410,7 +410,7 @@ export var EuiDataGridCell = /*#__PURE__*/function (_Component) {
|
|
|
410
410
|
}, {
|
|
411
411
|
key: "componentDidUpdate",
|
|
412
412
|
value: function componentDidUpdate(prevProps) {
|
|
413
|
-
var _this$props$rowHeight, _prevProps$rowHeights, _this$props$rowHeight2, _this$props$style, _prevProps$style;
|
|
413
|
+
var _this$props$rowHeight, _prevProps$rowHeights, _this$props$rowHeight2, _this$props$rowHeight3, _this$props$style, _prevProps$style;
|
|
414
414
|
|
|
415
415
|
this.recalculateAutoHeight();
|
|
416
416
|
|
|
@@ -418,16 +418,17 @@ export var EuiDataGridCell = /*#__PURE__*/function (_Component) {
|
|
|
418
418
|
this.recalculateLineHeight();
|
|
419
419
|
}
|
|
420
420
|
|
|
421
|
-
if ((_this$props$rowHeight2 = this.props.
|
|
421
|
+
if ((_this$props$rowHeight2 = this.props.rowHeightUtils) !== null && _this$props$rowHeight2 !== void 0 && _this$props$rowHeight2.compensateForLayoutShift && (_this$props$rowHeight3 = this.props.rowHeightsOptions) !== null && _this$props$rowHeight3 !== void 0 && _this$props$rowHeight3.scrollAnchorRow && this.props.colIndex === 0 && // once per row
|
|
422
422
|
this.props.columnId === prevProps.columnId && // if this is still the same column
|
|
423
423
|
this.props.rowIndex === prevProps.rowIndex && // if this is still the same row
|
|
424
424
|
((_this$props$style = this.props.style) === null || _this$props$style === void 0 ? void 0 : _this$props$style.top) !== ((_prevProps$style = prevProps.style) === null || _prevProps$style === void 0 ? void 0 : _prevProps$style.top) // if the top position has changed
|
|
425
425
|
) {
|
|
426
|
-
var _prevProps$style2, _this$props$style2, _this$props$
|
|
426
|
+
var _prevProps$style2, _this$props$style2, _this$props$rowHeight4;
|
|
427
427
|
|
|
428
428
|
var previousTop = parseFloat((_prevProps$style2 = prevProps.style) === null || _prevProps$style2 === void 0 ? void 0 : _prevProps$style2.top);
|
|
429
|
-
var currentTop = parseFloat((_this$props$style2 = this.props.style) === null || _this$props$style2 === void 0 ? void 0 : _this$props$style2.top);
|
|
430
|
-
|
|
429
|
+
var currentTop = parseFloat((_this$props$style2 = this.props.style) === null || _this$props$style2 === void 0 ? void 0 : _this$props$style2.top); // @ts-ignore We've already checked that this virtualization util is available above
|
|
430
|
+
|
|
431
|
+
this.props.rowHeightUtils.compensateForLayoutShift(this.props.rowIndex, currentTop - previousTop, (_this$props$rowHeight4 = this.props.rowHeightsOptions) === null || _this$props$rowHeight4 === void 0 ? void 0 : _this$props$rowHeight4.scrollAnchorRow);
|
|
431
432
|
}
|
|
432
433
|
|
|
433
434
|
if (this.props.popoverContext.popoverIsOpen !== prevProps.popoverContext.popoverIsOpen || this.props.popoverContext.cellLocation !== prevProps.popoverContext.cellLocation || this.props.renderCellPopover !== prevProps.renderCellPopover) {
|
|
@@ -517,8 +518,8 @@ export var EuiDataGridCell = /*#__PURE__*/function (_Component) {
|
|
|
517
518
|
});
|
|
518
519
|
|
|
519
520
|
cellProps.style = _objectSpread(_objectSpread({}, style), {}, {
|
|
520
|
-
//
|
|
521
|
-
top: 0,
|
|
521
|
+
// set by react-window or the custom renderer
|
|
522
|
+
top: style !== null && style !== void 0 && style.top ? 0 : undefined,
|
|
522
523
|
// The cell's row will handle top positioning
|
|
523
524
|
width: width,
|
|
524
525
|
// column width, can be undefined
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
4
|
+
var _excluded = ["colIndex", "visibleRowIndex", "style", "schema", "schemaDetectors", "pagination", "columns", "leadingControlColumns", "trailingControlColumns", "visibleColCount", "columnWidths", "defaultColumnWidth", "renderCellValue", "renderCellPopover", "interactiveCellId", "setRowHeight", "rowHeightsOptions", "rowHeightUtils", "rowManager"];
|
|
5
|
+
|
|
6
|
+
/*
|
|
7
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
8
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
9
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
10
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
11
|
+
* Side Public License, v 1.
|
|
12
|
+
*/
|
|
13
|
+
import React, { useContext, useMemo } from 'react';
|
|
14
|
+
import classNames from 'classnames';
|
|
15
|
+
import { DataGridSortingContext } from '../utils/sorting';
|
|
16
|
+
import { DataGridCellPopoverContext } from './data_grid_cell_popover';
|
|
17
|
+
import { EuiDataGridCell } from './data_grid_cell';
|
|
18
|
+
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* A DRY wrapper used by both custom and virtualized grid cells.
|
|
22
|
+
* It grabs context, determines the type of cell being rendered
|
|
23
|
+
* (e.g. control vs data cell), & sets shared props between all cells
|
|
24
|
+
*/
|
|
25
|
+
export var Cell = function Cell(_ref) {
|
|
26
|
+
var colIndex = _ref.colIndex,
|
|
27
|
+
visibleRowIndex = _ref.visibleRowIndex,
|
|
28
|
+
style = _ref.style,
|
|
29
|
+
schema = _ref.schema,
|
|
30
|
+
schemaDetectors = _ref.schemaDetectors,
|
|
31
|
+
pagination = _ref.pagination,
|
|
32
|
+
columns = _ref.columns,
|
|
33
|
+
leadingControlColumns = _ref.leadingControlColumns,
|
|
34
|
+
trailingControlColumns = _ref.trailingControlColumns,
|
|
35
|
+
visibleColCount = _ref.visibleColCount,
|
|
36
|
+
columnWidths = _ref.columnWidths,
|
|
37
|
+
defaultColumnWidth = _ref.defaultColumnWidth,
|
|
38
|
+
renderCellValue = _ref.renderCellValue,
|
|
39
|
+
renderCellPopover = _ref.renderCellPopover,
|
|
40
|
+
interactiveCellId = _ref.interactiveCellId,
|
|
41
|
+
setRowHeight = _ref.setRowHeight,
|
|
42
|
+
rowHeightsOptions = _ref.rowHeightsOptions,
|
|
43
|
+
rowHeightUtils = _ref.rowHeightUtils,
|
|
44
|
+
rowManager = _ref.rowManager,
|
|
45
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
46
|
+
|
|
47
|
+
var popoverContext = useContext(DataGridCellPopoverContext);
|
|
48
|
+
|
|
49
|
+
var _useContext = useContext(DataGridSortingContext),
|
|
50
|
+
getCorrectRowIndex = _useContext.getCorrectRowIndex;
|
|
51
|
+
|
|
52
|
+
var cellContent;
|
|
53
|
+
var isFirstColumn = colIndex === 0;
|
|
54
|
+
var isLastColumn = colIndex === visibleColCount - 1;
|
|
55
|
+
var isLeadingControlColumn = colIndex < leadingControlColumns.length;
|
|
56
|
+
var isTrailingControlColumn = colIndex >= leadingControlColumns.length + columns.length;
|
|
57
|
+
var datacolIndex = colIndex - leadingControlColumns.length;
|
|
58
|
+
var column = columns[datacolIndex];
|
|
59
|
+
var columnId = column === null || column === void 0 ? void 0 : column.id;
|
|
60
|
+
var textTransform = useMemo(function () {
|
|
61
|
+
var _schemaDetectors$filt;
|
|
62
|
+
|
|
63
|
+
return (_schemaDetectors$filt = schemaDetectors.filter(function (row) {
|
|
64
|
+
return column !== null && column !== void 0 && column.schema ? (column === null || column === void 0 ? void 0 : column.schema) === row.type : columnId === row.type;
|
|
65
|
+
})[0]) === null || _schemaDetectors$filt === void 0 ? void 0 : _schemaDetectors$filt.textTransform;
|
|
66
|
+
}, [columnId, column === null || column === void 0 ? void 0 : column.schema, schemaDetectors]);
|
|
67
|
+
var classes = classNames(_defineProperty({
|
|
68
|
+
'euiDataGridRowCell--firstColumn': isFirstColumn,
|
|
69
|
+
'euiDataGridRowCell--lastColumn': isLastColumn,
|
|
70
|
+
'euiDataGridRowCell--controlColumn': isLeadingControlColumn || isTrailingControlColumn
|
|
71
|
+
}, "euiDataGridRowCell--".concat(textTransform), textTransform));
|
|
72
|
+
var sharedCellProps = {
|
|
73
|
+
rowIndex: getCorrectRowIndex(visibleRowIndex),
|
|
74
|
+
visibleRowIndex: visibleRowIndex,
|
|
75
|
+
colIndex: colIndex,
|
|
76
|
+
interactiveCellId: interactiveCellId,
|
|
77
|
+
className: classes,
|
|
78
|
+
style: style,
|
|
79
|
+
rowHeightsOptions: rowHeightsOptions,
|
|
80
|
+
rowHeightUtils: rowHeightUtils,
|
|
81
|
+
setRowHeight: isFirstColumn ? setRowHeight : undefined,
|
|
82
|
+
rowManager: rowManager,
|
|
83
|
+
popoverContext: popoverContext,
|
|
84
|
+
pagination: pagination
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
if (isLeadingControlColumn) {
|
|
88
|
+
var leadingColumn = leadingControlColumns[colIndex];
|
|
89
|
+
var id = leadingColumn.id,
|
|
90
|
+
rowCellRender = leadingColumn.rowCellRender;
|
|
91
|
+
cellContent = ___EmotionJSX(EuiDataGridCell, _extends({}, sharedCellProps, {
|
|
92
|
+
columnId: id,
|
|
93
|
+
width: leadingColumn.width,
|
|
94
|
+
renderCellValue: rowCellRender,
|
|
95
|
+
isExpandable: false
|
|
96
|
+
}, rest));
|
|
97
|
+
} else if (isTrailingControlColumn) {
|
|
98
|
+
var columnOffset = columns.length + leadingControlColumns.length;
|
|
99
|
+
var trailingcolIndex = colIndex - columnOffset;
|
|
100
|
+
var trailingColumn = trailingControlColumns[trailingcolIndex];
|
|
101
|
+
var _id = trailingColumn.id,
|
|
102
|
+
_rowCellRender = trailingColumn.rowCellRender;
|
|
103
|
+
cellContent = ___EmotionJSX(EuiDataGridCell, _extends({}, sharedCellProps, {
|
|
104
|
+
columnId: _id,
|
|
105
|
+
width: trailingColumn.width,
|
|
106
|
+
renderCellValue: _rowCellRender,
|
|
107
|
+
isExpandable: false
|
|
108
|
+
}, rest));
|
|
109
|
+
} else {
|
|
110
|
+
// this is a normal data cell
|
|
111
|
+
var columnType = schema[columnId] ? schema[columnId].columnType : null;
|
|
112
|
+
var isExpandable = column.isExpandable !== undefined ? column.isExpandable : true;
|
|
113
|
+
var width = columnWidths[columnId] || defaultColumnWidth;
|
|
114
|
+
cellContent = ___EmotionJSX(EuiDataGridCell, _extends({}, sharedCellProps, {
|
|
115
|
+
columnId: columnId,
|
|
116
|
+
column: column,
|
|
117
|
+
columnType: columnType,
|
|
118
|
+
width: width || undefined,
|
|
119
|
+
renderCellValue: renderCellValue,
|
|
120
|
+
renderCellPopover: renderCellPopover,
|
|
121
|
+
interactiveCellId: interactiveCellId,
|
|
122
|
+
isExpandable: isExpandable
|
|
123
|
+
}, rest));
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
return cellContent;
|
|
127
|
+
};
|
|
@@ -13,12 +13,13 @@ import classnames from 'classnames';
|
|
|
13
13
|
import React, { forwardRef } from 'react';
|
|
14
14
|
import { EuiDataGridControlHeaderCell } from './data_grid_control_header_cell';
|
|
15
15
|
import { EuiDataGridHeaderCell } from './data_grid_header_cell';
|
|
16
|
+
import { emptyControlColumns } from '../../data_grid_types';
|
|
16
17
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
17
18
|
var EuiDataGridHeaderRow = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
18
19
|
var _props$leadingControl = props.leadingControlColumns,
|
|
19
|
-
leadingControlColumns = _props$leadingControl === void 0 ?
|
|
20
|
+
leadingControlColumns = _props$leadingControl === void 0 ? emptyControlColumns : _props$leadingControl,
|
|
20
21
|
_props$trailingContro = props.trailingControlColumns,
|
|
21
|
-
trailingControlColumns = _props$trailingContro === void 0 ?
|
|
22
|
+
trailingControlColumns = _props$trailingContro === void 0 ? emptyControlColumns : _props$trailingContro,
|
|
22
23
|
columns = props.columns,
|
|
23
24
|
schema = props.schema,
|
|
24
25
|
schemaDetectors = props.schemaDetectors,
|
|
@@ -3,7 +3,7 @@ import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
|
3
3
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
4
4
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
5
5
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
6
|
-
var _excluded = ["leadingControlColumns", "trailingControlColumns", "columns", "columnVisibility", "schemaDetectors", "rowCount", "renderCellValue", "renderCellPopover", "renderFooterCellValue", "className", "gridStyle", "toolbarVisibility", "pagination", "sorting", "inMemory", "onColumnResize", "minSizeForControls", "height", "width", "rowHeightsOptions", "virtualizationOptions"],
|
|
6
|
+
var _excluded = ["leadingControlColumns", "trailingControlColumns", "columns", "columnVisibility", "schemaDetectors", "rowCount", "renderCellValue", "renderCellPopover", "renderFooterCellValue", "className", "gridStyle", "toolbarVisibility", "pagination", "sorting", "inMemory", "onColumnResize", "minSizeForControls", "height", "width", "rowHeightsOptions", "virtualizationOptions", "renderCustomGridBody"],
|
|
7
7
|
_excluded2 = ["focusProps"];
|
|
8
8
|
|
|
9
9
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
@@ -35,8 +35,9 @@ import { computeVisibleRows } from './utils/row_count';
|
|
|
35
35
|
import { EuiDataGridPaginationRenderer } from './utils/data_grid_pagination';
|
|
36
36
|
import { schemaDetectors as providedSchemaDetectors, useMergedSchema } from './utils/data_grid_schema';
|
|
37
37
|
import { useImperativeGridRef } from './utils/ref';
|
|
38
|
+
import { emptyControlColumns } from './data_grid_types'; // Each gridStyle object above sets a specific CSS select to .euiGrid
|
|
39
|
+
|
|
38
40
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
39
|
-
// Each gridStyle object above sets a specific CSS select to .euiGrid
|
|
40
41
|
var fontSizesToClassMap = {
|
|
41
42
|
s: 'euiDataGrid--fontSizeSmall',
|
|
42
43
|
m: '',
|
|
@@ -69,9 +70,9 @@ export var EuiDataGrid = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
69
70
|
var _gridItemsRendered$cu;
|
|
70
71
|
|
|
71
72
|
var _props$leadingControl = props.leadingControlColumns,
|
|
72
|
-
leadingControlColumns = _props$leadingControl === void 0 ?
|
|
73
|
+
leadingControlColumns = _props$leadingControl === void 0 ? emptyControlColumns : _props$leadingControl,
|
|
73
74
|
_props$trailingContro = props.trailingControlColumns,
|
|
74
|
-
trailingControlColumns = _props$trailingContro === void 0 ?
|
|
75
|
+
trailingControlColumns = _props$trailingContro === void 0 ? emptyControlColumns : _props$trailingContro,
|
|
75
76
|
columns = props.columns,
|
|
76
77
|
columnVisibility = props.columnVisibility,
|
|
77
78
|
schemaDetectors = props.schemaDetectors,
|
|
@@ -92,6 +93,7 @@ export var EuiDataGrid = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
92
93
|
width = props.width,
|
|
93
94
|
_rowHeightsOptions = props.rowHeightsOptions,
|
|
94
95
|
virtualizationOptions = props.virtualizationOptions,
|
|
96
|
+
renderCustomGridBody = props.renderCustomGridBody,
|
|
95
97
|
rest = _objectWithoutProperties(props, _excluded);
|
|
96
98
|
/**
|
|
97
99
|
* Merge consumer settings with defaults
|
|
@@ -369,7 +371,8 @@ export var EuiDataGrid = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
369
371
|
gridWidth: gridWidth,
|
|
370
372
|
gridRef: gridRef,
|
|
371
373
|
gridItemsRendered: gridItemsRendered,
|
|
372
|
-
wrapperRef: contentRef
|
|
374
|
+
wrapperRef: contentRef,
|
|
375
|
+
renderCustomGridBody: renderCustomGridBody
|
|
373
376
|
})), pagination && props['aria-labelledby'] && ___EmotionJSX("p", {
|
|
374
377
|
id: ariaLabelledById,
|
|
375
378
|
hidden: true
|
|
@@ -1 +1,18 @@
|
|
|
1
|
-
|
|
1
|
+
/*
|
|
2
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
3
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
4
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
5
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
6
|
+
* Side Public License, v 1.
|
|
7
|
+
*/
|
|
8
|
+
// since react-window doesn't export a type with the imperative api only we can
|
|
9
|
+
// use this to omit the react-specific class component methods
|
|
10
|
+
// An array of [x,y] coordinates. Note that the `y` value expected internally is a `visibleRowIndex`
|
|
11
|
+
// Force either aria-label or aria-labelledby to be defined
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Props shared between renderCellValue and renderCellPopover
|
|
15
|
+
*/
|
|
16
|
+
// The empty control column array fallbacks need to be cached, or
|
|
17
|
+
// they'll cause rerendering/remount issues in memoized dependencies
|
|
18
|
+
export var emptyControlColumns = [];
|