@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,198 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
+
|
|
7
|
+
Object.defineProperty(exports, "__esModule", {
|
|
8
|
+
value: true
|
|
9
|
+
});
|
|
10
|
+
exports.EuiDataGridBodyCustomRender = void 0;
|
|
11
|
+
|
|
12
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
13
|
+
|
|
14
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
15
|
+
|
|
16
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
17
|
+
|
|
18
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
19
|
+
|
|
20
|
+
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
21
|
+
|
|
22
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
23
|
+
|
|
24
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
25
|
+
|
|
26
|
+
var _col_widths = require("../utils/col_widths");
|
|
27
|
+
|
|
28
|
+
var _row_heights = require("../utils/row_heights");
|
|
29
|
+
|
|
30
|
+
var _header = require("./header");
|
|
31
|
+
|
|
32
|
+
var _footer = require("./footer");
|
|
33
|
+
|
|
34
|
+
var _data_grid_cell_wrapper = require("./data_grid_cell_wrapper");
|
|
35
|
+
|
|
36
|
+
var _react2 = require("@emotion/react");
|
|
37
|
+
|
|
38
|
+
var _excluded = ["colIndex", "visibleRowIndex"];
|
|
39
|
+
|
|
40
|
+
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); }
|
|
41
|
+
|
|
42
|
+
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; }
|
|
43
|
+
|
|
44
|
+
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; }
|
|
45
|
+
|
|
46
|
+
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; }
|
|
47
|
+
|
|
48
|
+
var EuiDataGridBodyCustomRender = function EuiDataGridBodyCustomRender(_ref) {
|
|
49
|
+
var renderCustomGridBody = _ref.renderCustomGridBody,
|
|
50
|
+
leadingControlColumns = _ref.leadingControlColumns,
|
|
51
|
+
trailingControlColumns = _ref.trailingControlColumns,
|
|
52
|
+
columns = _ref.columns,
|
|
53
|
+
visibleColCount = _ref.visibleColCount,
|
|
54
|
+
schema = _ref.schema,
|
|
55
|
+
schemaDetectors = _ref.schemaDetectors,
|
|
56
|
+
visibleRows = _ref.visibleRows,
|
|
57
|
+
renderCellValue = _ref.renderCellValue,
|
|
58
|
+
renderCellPopover = _ref.renderCellPopover,
|
|
59
|
+
renderFooterCellValue = _ref.renderFooterCellValue,
|
|
60
|
+
interactiveCellId = _ref.interactiveCellId,
|
|
61
|
+
headerIsInteractive = _ref.headerIsInteractive,
|
|
62
|
+
handleHeaderMutation = _ref.handleHeaderMutation,
|
|
63
|
+
setVisibleColumns = _ref.setVisibleColumns,
|
|
64
|
+
switchColumnPos = _ref.switchColumnPos,
|
|
65
|
+
onColumnResize = _ref.onColumnResize,
|
|
66
|
+
gridWidth = _ref.gridWidth,
|
|
67
|
+
gridStyles = _ref.gridStyles,
|
|
68
|
+
pagination = _ref.pagination,
|
|
69
|
+
rowHeightsOptions = _ref.rowHeightsOptions;
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Columns & widths
|
|
73
|
+
*/
|
|
74
|
+
var visibleColumns = (0, _react.useMemo)(function () {
|
|
75
|
+
return [].concat((0, _toConsumableArray2.default)(leadingControlColumns), (0, _toConsumableArray2.default)(columns), (0, _toConsumableArray2.default)(trailingControlColumns));
|
|
76
|
+
}, [columns, leadingControlColumns, trailingControlColumns]); // compute the default column width from the container's width and count of visible columns
|
|
77
|
+
|
|
78
|
+
var defaultColumnWidth = (0, _col_widths.useDefaultColumnWidth)(gridWidth, leadingControlColumns, trailingControlColumns, columns);
|
|
79
|
+
|
|
80
|
+
var _useColumnWidths = (0, _col_widths.useColumnWidths)({
|
|
81
|
+
columns: columns,
|
|
82
|
+
leadingControlColumns: leadingControlColumns,
|
|
83
|
+
trailingControlColumns: trailingControlColumns,
|
|
84
|
+
defaultColumnWidth: defaultColumnWidth,
|
|
85
|
+
onColumnResize: onColumnResize
|
|
86
|
+
}),
|
|
87
|
+
columnWidths = _useColumnWidths.columnWidths,
|
|
88
|
+
setColumnWidth = _useColumnWidths.setColumnWidth;
|
|
89
|
+
/**
|
|
90
|
+
* Row heights
|
|
91
|
+
*/
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
var rowHeightUtils = (0, _row_heights.useRowHeightUtils)({
|
|
95
|
+
rowHeightsOptions: rowHeightsOptions,
|
|
96
|
+
gridStyles: gridStyles,
|
|
97
|
+
columns: columns
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
var _useDefaultRowHeight = (0, _row_heights.useDefaultRowHeight)({
|
|
101
|
+
rowHeightsOptions: rowHeightsOptions,
|
|
102
|
+
rowHeightUtils: rowHeightUtils
|
|
103
|
+
}),
|
|
104
|
+
setRowHeight = _useDefaultRowHeight.setRowHeight,
|
|
105
|
+
getRowHeight = _useDefaultRowHeight.getRowHeight;
|
|
106
|
+
/**
|
|
107
|
+
* Header & footer
|
|
108
|
+
*/
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
var _useDataGridHeader = (0, _header.useDataGridHeader)({
|
|
112
|
+
headerIsInteractive: headerIsInteractive,
|
|
113
|
+
handleHeaderMutation: handleHeaderMutation,
|
|
114
|
+
switchColumnPos: switchColumnPos,
|
|
115
|
+
setVisibleColumns: setVisibleColumns,
|
|
116
|
+
leadingControlColumns: leadingControlColumns,
|
|
117
|
+
trailingControlColumns: trailingControlColumns,
|
|
118
|
+
columns: columns,
|
|
119
|
+
columnWidths: columnWidths,
|
|
120
|
+
defaultColumnWidth: defaultColumnWidth,
|
|
121
|
+
setColumnWidth: setColumnWidth,
|
|
122
|
+
schema: schema,
|
|
123
|
+
schemaDetectors: schemaDetectors
|
|
124
|
+
}),
|
|
125
|
+
headerRow = _useDataGridHeader.headerRow;
|
|
126
|
+
|
|
127
|
+
var _useDataGridFooter = (0, _footer.useDataGridFooter)({
|
|
128
|
+
renderFooterCellValue: renderFooterCellValue,
|
|
129
|
+
renderCellPopover: renderCellPopover,
|
|
130
|
+
rowIndex: visibleRows.visibleRowCount,
|
|
131
|
+
visibleRowIndex: visibleRows.visibleRowCount,
|
|
132
|
+
interactiveCellId: interactiveCellId,
|
|
133
|
+
leadingControlColumns: leadingControlColumns,
|
|
134
|
+
trailingControlColumns: trailingControlColumns,
|
|
135
|
+
columns: columns,
|
|
136
|
+
columnWidths: columnWidths,
|
|
137
|
+
defaultColumnWidth: defaultColumnWidth,
|
|
138
|
+
schema: schema
|
|
139
|
+
}),
|
|
140
|
+
footerRow = _useDataGridFooter.footerRow;
|
|
141
|
+
/**
|
|
142
|
+
* Cell render fn
|
|
143
|
+
*/
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
var cellProps = {
|
|
147
|
+
schema: schema,
|
|
148
|
+
schemaDetectors: schemaDetectors,
|
|
149
|
+
pagination: pagination,
|
|
150
|
+
columns: columns,
|
|
151
|
+
leadingControlColumns: leadingControlColumns,
|
|
152
|
+
trailingControlColumns: trailingControlColumns,
|
|
153
|
+
visibleColCount: visibleColCount,
|
|
154
|
+
columnWidths: columnWidths,
|
|
155
|
+
defaultColumnWidth: defaultColumnWidth,
|
|
156
|
+
renderCellValue: renderCellValue,
|
|
157
|
+
renderCellPopover: renderCellPopover,
|
|
158
|
+
interactiveCellId: interactiveCellId,
|
|
159
|
+
setRowHeight: setRowHeight,
|
|
160
|
+
rowHeightsOptions: rowHeightsOptions,
|
|
161
|
+
rowHeightUtils: rowHeightUtils
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
var _Cell = (0, _react.useCallback)(function (_ref2) {
|
|
165
|
+
var colIndex = _ref2.colIndex,
|
|
166
|
+
visibleRowIndex = _ref2.visibleRowIndex,
|
|
167
|
+
rest = (0, _objectWithoutProperties2.default)(_ref2, _excluded);
|
|
168
|
+
var style = {
|
|
169
|
+
height: rowHeightUtils.isAutoHeight(visibleRowIndex, rowHeightsOptions) ? 'auto' : getRowHeight(visibleRowIndex)
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
var props = _objectSpread({
|
|
173
|
+
colIndex: colIndex,
|
|
174
|
+
visibleRowIndex: visibleRowIndex,
|
|
175
|
+
style: style
|
|
176
|
+
}, cellProps);
|
|
177
|
+
|
|
178
|
+
return (0, _react2.jsx)(_data_grid_cell_wrapper.Cell, (0, _extends2.default)({}, props, rest));
|
|
179
|
+
}, [].concat((0, _toConsumableArray2.default)(Object.values(cellProps)), [getRowHeight]) // eslint-disable-line react-hooks/exhaustive-deps
|
|
180
|
+
); // Allow consumers to pass custom props/attributes/listeners etc. to the wrapping div
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
var _useState = (0, _react.useState)({}),
|
|
184
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
185
|
+
customGridBodyProps = _useState2[0],
|
|
186
|
+
setCustomGridBodyProps = _useState2[1];
|
|
187
|
+
|
|
188
|
+
return (0, _react2.jsx)("div", (0, _extends2.default)({}, customGridBodyProps, {
|
|
189
|
+
className: (0, _classnames.default)('euiDataGrid__customRenderBody', customGridBodyProps === null || customGridBodyProps === void 0 ? void 0 : customGridBodyProps.className)
|
|
190
|
+
}), headerRow, renderCustomGridBody({
|
|
191
|
+
visibleColumns: visibleColumns,
|
|
192
|
+
visibleRowData: visibleRows,
|
|
193
|
+
Cell: _Cell,
|
|
194
|
+
setCustomGridBodyProps: setCustomGridBodyProps
|
|
195
|
+
}), footerRow);
|
|
196
|
+
};
|
|
197
|
+
|
|
198
|
+
exports.EuiDataGridBodyCustomRender = EuiDataGridBodyCustomRender;
|
|
@@ -0,0 +1,342 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
+
|
|
7
|
+
Object.defineProperty(exports, "__esModule", {
|
|
8
|
+
value: true
|
|
9
|
+
});
|
|
10
|
+
exports._Cell = exports.EuiDataGridBodyVirtualized = exports.DataGridWrapperRowsContext = void 0;
|
|
11
|
+
|
|
12
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
13
|
+
|
|
14
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
15
|
+
|
|
16
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
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 _header = require("./header");
|
|
27
|
+
|
|
28
|
+
var _footer = require("./footer");
|
|
29
|
+
|
|
30
|
+
var _data_grid_cell_wrapper = require("./data_grid_cell_wrapper");
|
|
31
|
+
|
|
32
|
+
var _data_grid_row_manager = require("./data_grid_row_manager");
|
|
33
|
+
|
|
34
|
+
var _grid_height_width = require("../utils/grid_height_width");
|
|
35
|
+
|
|
36
|
+
var _col_widths = require("../utils/col_widths");
|
|
37
|
+
|
|
38
|
+
var _row_heights = require("../utils/row_heights");
|
|
39
|
+
|
|
40
|
+
var _scrolling = require("../utils/scrolling");
|
|
41
|
+
|
|
42
|
+
var _utils = require("../../../utils");
|
|
43
|
+
|
|
44
|
+
var _react2 = require("@emotion/react");
|
|
45
|
+
|
|
46
|
+
var _excluded = ["children", "style"];
|
|
47
|
+
|
|
48
|
+
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); }
|
|
49
|
+
|
|
50
|
+
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; }
|
|
51
|
+
|
|
52
|
+
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; }
|
|
53
|
+
|
|
54
|
+
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; }
|
|
55
|
+
|
|
56
|
+
var _Cell = function _Cell(_ref) {
|
|
57
|
+
var columnIndex = _ref.columnIndex,
|
|
58
|
+
rowIndex = _ref.rowIndex,
|
|
59
|
+
style = _ref.style,
|
|
60
|
+
data = _ref.data;
|
|
61
|
+
|
|
62
|
+
var _useContext = (0, _react.useContext)(DataGridWrapperRowsContext),
|
|
63
|
+
headerRowHeight = _useContext.headerRowHeight;
|
|
64
|
+
|
|
65
|
+
return (0, _react2.jsx)(_data_grid_cell_wrapper.Cell, (0, _extends2.default)({
|
|
66
|
+
colIndex: columnIndex,
|
|
67
|
+
visibleRowIndex: rowIndex,
|
|
68
|
+
style: _objectSpread(_objectSpread({}, style), {}, {
|
|
69
|
+
top: "".concat(parseFloat(style.top) + headerRowHeight, "px")
|
|
70
|
+
})
|
|
71
|
+
}, data));
|
|
72
|
+
}; // Context is required to pass props to react-window's innerElementType
|
|
73
|
+
// @see https://github.com/bvaughn/react-window/issues/404
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
exports._Cell = _Cell;
|
|
77
|
+
var DataGridWrapperRowsContext = /*#__PURE__*/(0, _react.createContext)({
|
|
78
|
+
headerRow: (0, _react2.jsx)("div", null),
|
|
79
|
+
headerRowHeight: 0,
|
|
80
|
+
footerRow: null
|
|
81
|
+
});
|
|
82
|
+
exports.DataGridWrapperRowsContext = DataGridWrapperRowsContext;
|
|
83
|
+
var InnerElement = /*#__PURE__*/(0, _react.forwardRef)(function (_ref2, ref) {
|
|
84
|
+
var children = _ref2.children,
|
|
85
|
+
style = _ref2.style,
|
|
86
|
+
rest = (0, _objectWithoutProperties2.default)(_ref2, _excluded);
|
|
87
|
+
|
|
88
|
+
var _useContext2 = (0, _react.useContext)(DataGridWrapperRowsContext),
|
|
89
|
+
headerRowHeight = _useContext2.headerRowHeight,
|
|
90
|
+
headerRow = _useContext2.headerRow,
|
|
91
|
+
footerRow = _useContext2.footerRow;
|
|
92
|
+
|
|
93
|
+
return (0, _react2.jsx)(_react.default.Fragment, null, (0, _react2.jsx)("div", (0, _extends2.default)({
|
|
94
|
+
ref: ref,
|
|
95
|
+
style: _objectSpread(_objectSpread({}, style), {}, {
|
|
96
|
+
height: style.height + headerRowHeight
|
|
97
|
+
})
|
|
98
|
+
}, rest), headerRow, children), footerRow);
|
|
99
|
+
});
|
|
100
|
+
InnerElement.displayName = 'EuiDataGridInnerElement';
|
|
101
|
+
|
|
102
|
+
var EuiDataGridBodyVirtualized = function EuiDataGridBodyVirtualized(_ref3) {
|
|
103
|
+
var leadingControlColumns = _ref3.leadingControlColumns,
|
|
104
|
+
trailingControlColumns = _ref3.trailingControlColumns,
|
|
105
|
+
columns = _ref3.columns,
|
|
106
|
+
visibleColCount = _ref3.visibleColCount,
|
|
107
|
+
schema = _ref3.schema,
|
|
108
|
+
schemaDetectors = _ref3.schemaDetectors,
|
|
109
|
+
rowCount = _ref3.rowCount,
|
|
110
|
+
_ref3$visibleRows = _ref3.visibleRows,
|
|
111
|
+
startRow = _ref3$visibleRows.startRow,
|
|
112
|
+
endRow = _ref3$visibleRows.endRow,
|
|
113
|
+
visibleRowCount = _ref3$visibleRows.visibleRowCount,
|
|
114
|
+
renderCellValue = _ref3.renderCellValue,
|
|
115
|
+
renderCellPopover = _ref3.renderCellPopover,
|
|
116
|
+
renderFooterCellValue = _ref3.renderFooterCellValue,
|
|
117
|
+
interactiveCellId = _ref3.interactiveCellId,
|
|
118
|
+
pagination = _ref3.pagination,
|
|
119
|
+
headerIsInteractive = _ref3.headerIsInteractive,
|
|
120
|
+
handleHeaderMutation = _ref3.handleHeaderMutation,
|
|
121
|
+
setVisibleColumns = _ref3.setVisibleColumns,
|
|
122
|
+
switchColumnPos = _ref3.switchColumnPos,
|
|
123
|
+
onColumnResize = _ref3.onColumnResize,
|
|
124
|
+
rowHeightsOptions = _ref3.rowHeightsOptions,
|
|
125
|
+
virtualizationOptions = _ref3.virtualizationOptions,
|
|
126
|
+
isFullScreen = _ref3.isFullScreen,
|
|
127
|
+
gridStyles = _ref3.gridStyles,
|
|
128
|
+
gridWidth = _ref3.gridWidth,
|
|
129
|
+
gridRef = _ref3.gridRef,
|
|
130
|
+
gridItemsRendered = _ref3.gridItemsRendered,
|
|
131
|
+
wrapperRef = _ref3.wrapperRef;
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Grid refs & observers
|
|
135
|
+
*/
|
|
136
|
+
var wrapperDimensions = (0, _resize_observer.useResizeObserver)(wrapperRef.current);
|
|
137
|
+
var outerGridRef = (0, _react.useRef)(null); // container that becomes scrollable
|
|
138
|
+
|
|
139
|
+
var innerGridRef = (0, _react.useRef)(null); // container sized to fit all content
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* Scroll bars
|
|
143
|
+
*/
|
|
144
|
+
|
|
145
|
+
var _useScrollBars = (0, _scrolling.useScrollBars)(outerGridRef, gridStyles.border),
|
|
146
|
+
scrollBarHeight = _useScrollBars.scrollBarHeight,
|
|
147
|
+
hasVerticalScroll = _useScrollBars.hasVerticalScroll,
|
|
148
|
+
hasHorizontalScroll = _useScrollBars.hasHorizontalScroll,
|
|
149
|
+
scrollBorderOverlay = _useScrollBars.scrollBorderOverlay;
|
|
150
|
+
/**
|
|
151
|
+
* Widths
|
|
152
|
+
*/
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
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
|
|
156
|
+
|
|
157
|
+
var defaultColumnWidth = (0, _col_widths.useDefaultColumnWidth)(virtualizeContainerWidth, leadingControlColumns, trailingControlColumns, columns);
|
|
158
|
+
|
|
159
|
+
var _useColumnWidths = (0, _col_widths.useColumnWidths)({
|
|
160
|
+
columns: columns,
|
|
161
|
+
leadingControlColumns: leadingControlColumns,
|
|
162
|
+
trailingControlColumns: trailingControlColumns,
|
|
163
|
+
defaultColumnWidth: defaultColumnWidth,
|
|
164
|
+
onColumnResize: onColumnResize
|
|
165
|
+
}),
|
|
166
|
+
columnWidths = _useColumnWidths.columnWidths,
|
|
167
|
+
setColumnWidth = _useColumnWidths.setColumnWidth,
|
|
168
|
+
getColumnWidth = _useColumnWidths.getColumnWidth;
|
|
169
|
+
/**
|
|
170
|
+
* Header & footer
|
|
171
|
+
*/
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
var _useDataGridHeader = (0, _header.useDataGridHeader)({
|
|
175
|
+
headerIsInteractive: headerIsInteractive,
|
|
176
|
+
handleHeaderMutation: handleHeaderMutation,
|
|
177
|
+
switchColumnPos: switchColumnPos,
|
|
178
|
+
setVisibleColumns: setVisibleColumns,
|
|
179
|
+
leadingControlColumns: leadingControlColumns,
|
|
180
|
+
trailingControlColumns: trailingControlColumns,
|
|
181
|
+
columns: columns,
|
|
182
|
+
columnWidths: columnWidths,
|
|
183
|
+
defaultColumnWidth: defaultColumnWidth,
|
|
184
|
+
setColumnWidth: setColumnWidth,
|
|
185
|
+
schema: schema,
|
|
186
|
+
schemaDetectors: schemaDetectors
|
|
187
|
+
}),
|
|
188
|
+
headerRow = _useDataGridHeader.headerRow,
|
|
189
|
+
headerRowHeight = _useDataGridHeader.headerRowHeight;
|
|
190
|
+
|
|
191
|
+
var _useDataGridFooter = (0, _footer.useDataGridFooter)({
|
|
192
|
+
renderFooterCellValue: renderFooterCellValue,
|
|
193
|
+
renderCellPopover: renderCellPopover,
|
|
194
|
+
rowIndex: visibleRowCount,
|
|
195
|
+
visibleRowIndex: visibleRowCount,
|
|
196
|
+
interactiveCellId: interactiveCellId,
|
|
197
|
+
leadingControlColumns: leadingControlColumns,
|
|
198
|
+
trailingControlColumns: trailingControlColumns,
|
|
199
|
+
columns: columns,
|
|
200
|
+
columnWidths: columnWidths,
|
|
201
|
+
defaultColumnWidth: defaultColumnWidth,
|
|
202
|
+
schema: schema
|
|
203
|
+
}),
|
|
204
|
+
footerRow = _useDataGridFooter.footerRow,
|
|
205
|
+
footerRowHeight = _useDataGridFooter.footerRowHeight;
|
|
206
|
+
/**
|
|
207
|
+
* Handle scrolling cells fully into view
|
|
208
|
+
*/
|
|
209
|
+
|
|
210
|
+
|
|
211
|
+
(0, _scrolling.useScroll)({
|
|
212
|
+
gridRef: gridRef,
|
|
213
|
+
outerGridRef: outerGridRef,
|
|
214
|
+
hasGridScrolling: hasVerticalScroll || hasHorizontalScroll,
|
|
215
|
+
headerRowHeight: headerRowHeight,
|
|
216
|
+
footerRowHeight: footerRowHeight,
|
|
217
|
+
visibleRowCount: visibleRowCount,
|
|
218
|
+
hasStickyFooter: !!(renderFooterCellValue && gridStyles.stickyFooter)
|
|
219
|
+
});
|
|
220
|
+
/**
|
|
221
|
+
* Row manager
|
|
222
|
+
*/
|
|
223
|
+
|
|
224
|
+
var rowManager = (0, _data_grid_row_manager.useRowManager)({
|
|
225
|
+
innerGridRef: innerGridRef,
|
|
226
|
+
rowClasses: gridStyles.rowClasses
|
|
227
|
+
});
|
|
228
|
+
/**
|
|
229
|
+
* Heights
|
|
230
|
+
*/
|
|
231
|
+
|
|
232
|
+
var rowHeightUtils = (0, _row_heights.useRowHeightUtils)({
|
|
233
|
+
virtualization: {
|
|
234
|
+
gridRef: gridRef,
|
|
235
|
+
outerGridElementRef: outerGridRef,
|
|
236
|
+
gridItemsRenderedRef: gridItemsRendered
|
|
237
|
+
},
|
|
238
|
+
rowHeightsOptions: rowHeightsOptions,
|
|
239
|
+
gridStyles: gridStyles,
|
|
240
|
+
columns: columns
|
|
241
|
+
});
|
|
242
|
+
|
|
243
|
+
var _useDefaultRowHeight = (0, _row_heights.useDefaultRowHeight)({
|
|
244
|
+
rowHeightsOptions: rowHeightsOptions,
|
|
245
|
+
rowHeightUtils: rowHeightUtils
|
|
246
|
+
}),
|
|
247
|
+
defaultRowHeight = _useDefaultRowHeight.defaultRowHeight,
|
|
248
|
+
setRowHeight = _useDefaultRowHeight.setRowHeight,
|
|
249
|
+
getRowHeight = _useDefaultRowHeight.getRowHeight;
|
|
250
|
+
|
|
251
|
+
var unconstrainedHeight = (0, _grid_height_width.useUnconstrainedHeight)({
|
|
252
|
+
rowHeightUtils: rowHeightUtils,
|
|
253
|
+
startRow: startRow,
|
|
254
|
+
endRow: endRow,
|
|
255
|
+
rowHeightsOptions: rowHeightsOptions,
|
|
256
|
+
defaultRowHeight: defaultRowHeight,
|
|
257
|
+
headerRowHeight: headerRowHeight,
|
|
258
|
+
footerRowHeight: footerRowHeight,
|
|
259
|
+
scrollBarHeight: scrollBarHeight,
|
|
260
|
+
innerGridRef: innerGridRef
|
|
261
|
+
});
|
|
262
|
+
/**
|
|
263
|
+
* Final grid height & width
|
|
264
|
+
*/
|
|
265
|
+
|
|
266
|
+
var _useFinalGridDimensio = (0, _grid_height_width.useFinalGridDimensions)({
|
|
267
|
+
unconstrainedHeight: unconstrainedHeight,
|
|
268
|
+
unconstrainedWidth: 0,
|
|
269
|
+
// unable to determine this until the container's size is known
|
|
270
|
+
wrapperDimensions: wrapperDimensions,
|
|
271
|
+
wrapperRef: wrapperRef,
|
|
272
|
+
isFullScreen: isFullScreen,
|
|
273
|
+
rowCount: rowCount
|
|
274
|
+
}),
|
|
275
|
+
finalWidth = _useFinalGridDimensio.finalWidth,
|
|
276
|
+
finalHeight = _useFinalGridDimensio.finalHeight;
|
|
277
|
+
/**
|
|
278
|
+
* Grid resets
|
|
279
|
+
*/
|
|
280
|
+
|
|
281
|
+
|
|
282
|
+
(0, _react.useEffect)(function () {
|
|
283
|
+
if (gridRef.current) {
|
|
284
|
+
gridRef.current.resetAfterColumnIndex(0);
|
|
285
|
+
}
|
|
286
|
+
}, [gridRef, columns, columnWidths, defaultColumnWidth]);
|
|
287
|
+
(0, _react.useEffect)(function () {
|
|
288
|
+
if (gridRef.current && rowHeightsOptions) {
|
|
289
|
+
gridRef.current.resetAfterRowIndex(0);
|
|
290
|
+
}
|
|
291
|
+
}, [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]);
|
|
292
|
+
(0, _react.useEffect)(function () {
|
|
293
|
+
if (gridRef.current) {
|
|
294
|
+
gridRef.current.resetAfterRowIndex(0);
|
|
295
|
+
}
|
|
296
|
+
}, [gridRef, getRowHeight]);
|
|
297
|
+
return _utils.IS_JEST_ENVIRONMENT || finalWidth > 0 ? (0, _react2.jsx)(DataGridWrapperRowsContext.Provider, {
|
|
298
|
+
value: {
|
|
299
|
+
headerRowHeight: headerRowHeight,
|
|
300
|
+
headerRow: headerRow,
|
|
301
|
+
footerRow: footerRow
|
|
302
|
+
}
|
|
303
|
+
}, (0, _react2.jsx)(_reactWindow.VariableSizeGrid, (0, _extends2.default)({}, virtualizationOptions ? virtualizationOptions : {}, {
|
|
304
|
+
ref: gridRef,
|
|
305
|
+
className: (0, _classnames.default)('euiDataGrid__virtualized', virtualizationOptions === null || virtualizationOptions === void 0 ? void 0 : virtualizationOptions.className),
|
|
306
|
+
onItemsRendered: function onItemsRendered(itemsRendered) {
|
|
307
|
+
var _virtualizationOption;
|
|
308
|
+
|
|
309
|
+
gridItemsRendered.current = itemsRendered;
|
|
310
|
+
virtualizationOptions === null || virtualizationOptions === void 0 ? void 0 : (_virtualizationOption = virtualizationOptions.onItemsRendered) === null || _virtualizationOption === void 0 ? void 0 : _virtualizationOption.call(virtualizationOptions, itemsRendered);
|
|
311
|
+
},
|
|
312
|
+
innerElementType: InnerElement,
|
|
313
|
+
outerRef: outerGridRef,
|
|
314
|
+
innerRef: innerGridRef,
|
|
315
|
+
columnCount: visibleColCount,
|
|
316
|
+
width: finalWidth,
|
|
317
|
+
columnWidth: getColumnWidth,
|
|
318
|
+
height: finalHeight,
|
|
319
|
+
rowHeight: getRowHeight,
|
|
320
|
+
itemData: {
|
|
321
|
+
schemaDetectors: schemaDetectors,
|
|
322
|
+
setRowHeight: setRowHeight,
|
|
323
|
+
leadingControlColumns: leadingControlColumns,
|
|
324
|
+
trailingControlColumns: trailingControlColumns,
|
|
325
|
+
columns: columns,
|
|
326
|
+
visibleColCount: visibleColCount,
|
|
327
|
+
schema: schema,
|
|
328
|
+
columnWidths: columnWidths,
|
|
329
|
+
defaultColumnWidth: defaultColumnWidth,
|
|
330
|
+
renderCellValue: renderCellValue,
|
|
331
|
+
renderCellPopover: renderCellPopover,
|
|
332
|
+
interactiveCellId: interactiveCellId,
|
|
333
|
+
rowHeightsOptions: rowHeightsOptions,
|
|
334
|
+
rowHeightUtils: rowHeightUtils,
|
|
335
|
+
rowManager: rowManager,
|
|
336
|
+
pagination: pagination
|
|
337
|
+
},
|
|
338
|
+
rowCount: _utils.IS_JEST_ENVIRONMENT || headerRowHeight > 0 ? visibleRowCount : 0
|
|
339
|
+
}), _Cell), scrollBorderOverlay) : null;
|
|
340
|
+
};
|
|
341
|
+
|
|
342
|
+
exports.EuiDataGridBodyVirtualized = EuiDataGridBodyVirtualized;
|
|
@@ -415,7 +415,7 @@ var EuiDataGridCell = /*#__PURE__*/function (_Component) {
|
|
|
415
415
|
}, {
|
|
416
416
|
key: "componentDidUpdate",
|
|
417
417
|
value: function componentDidUpdate(prevProps) {
|
|
418
|
-
var _this$props$rowHeight, _prevProps$rowHeights, _this$props$rowHeight2, _this$props$style, _prevProps$style;
|
|
418
|
+
var _this$props$rowHeight, _prevProps$rowHeights, _this$props$rowHeight2, _this$props$rowHeight3, _this$props$style, _prevProps$style;
|
|
419
419
|
|
|
420
420
|
this.recalculateAutoHeight();
|
|
421
421
|
|
|
@@ -423,16 +423,17 @@ var EuiDataGridCell = /*#__PURE__*/function (_Component) {
|
|
|
423
423
|
this.recalculateLineHeight();
|
|
424
424
|
}
|
|
425
425
|
|
|
426
|
-
if ((_this$props$rowHeight2 = this.props.
|
|
426
|
+
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
|
|
427
427
|
this.props.columnId === prevProps.columnId && // if this is still the same column
|
|
428
428
|
this.props.rowIndex === prevProps.rowIndex && // if this is still the same row
|
|
429
429
|
((_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
|
|
430
430
|
) {
|
|
431
|
-
var _prevProps$style2, _this$props$style2, _this$props$
|
|
431
|
+
var _prevProps$style2, _this$props$style2, _this$props$rowHeight4;
|
|
432
432
|
|
|
433
433
|
var previousTop = parseFloat((_prevProps$style2 = prevProps.style) === null || _prevProps$style2 === void 0 ? void 0 : _prevProps$style2.top);
|
|
434
|
-
var currentTop = parseFloat((_this$props$style2 = this.props.style) === null || _this$props$style2 === void 0 ? void 0 : _this$props$style2.top);
|
|
435
|
-
|
|
434
|
+
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
|
|
435
|
+
|
|
436
|
+
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);
|
|
436
437
|
}
|
|
437
438
|
|
|
438
439
|
if (this.props.popoverContext.popoverIsOpen !== prevProps.popoverContext.popoverIsOpen || this.props.popoverContext.cellLocation !== prevProps.popoverContext.cellLocation || this.props.renderCellPopover !== prevProps.renderCellPopover) {
|
|
@@ -520,8 +521,8 @@ var EuiDataGridCell = /*#__PURE__*/function (_Component) {
|
|
|
520
521
|
});
|
|
521
522
|
|
|
522
523
|
cellProps.style = _objectSpread(_objectSpread({}, style), {}, {
|
|
523
|
-
//
|
|
524
|
-
top: 0,
|
|
524
|
+
// set by react-window or the custom renderer
|
|
525
|
+
top: style !== null && style !== void 0 && style.top ? 0 : undefined,
|
|
525
526
|
// The cell's row will handle top positioning
|
|
526
527
|
width: width,
|
|
527
528
|
// column width, can be undefined
|