@elastic/eui 76.1.0 → 76.3.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/accessibility/skip_link/skip_link.js +15 -4
- 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/code/code_block_full_screen.js +2 -0
- 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/flyout/flyout.js +1 -0
- 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/image/image_fullscreen_wrapper.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 +236 -139
- package/i18ntokens.json +8 -8
- package/lib/components/accessibility/skip_link/skip_link.js +15 -4
- 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/code/code_block_full_screen.js +2 -0
- 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/flyout/flyout.js +1 -0
- 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/image/image_fullscreen_wrapper.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/accessibility/skip_link/skip_link.js +8 -1
- package/optimize/es/components/code/code_block_full_screen.js +2 -0
- 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/flyout/flyout.js +1 -0
- package/optimize/es/components/icon/icon_map.js +2 -0
- package/optimize/es/components/image/image_fullscreen_wrapper.js +2 -0
- package/optimize/lib/components/accessibility/skip_link/skip_link.js +8 -1
- package/optimize/lib/components/code/code_block_full_screen.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/flyout/flyout.js +1 -0
- package/optimize/lib/components/icon/icon_map.js +2 -0
- package/optimize/lib/components/image/image_fullscreen_wrapper.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/accessibility/skip_link/skip_link.js +15 -4
- 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/code/code_block_full_screen.js +2 -0
- 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/image/image_fullscreen_wrapper.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,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
|
|
@@ -0,0 +1,144 @@
|
|
|
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 = void 0;
|
|
11
|
+
|
|
12
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
13
|
+
|
|
14
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
15
|
+
|
|
16
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
17
|
+
|
|
18
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
19
|
+
|
|
20
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
21
|
+
|
|
22
|
+
var _sorting = require("../utils/sorting");
|
|
23
|
+
|
|
24
|
+
var _data_grid_cell_popover = require("./data_grid_cell_popover");
|
|
25
|
+
|
|
26
|
+
var _data_grid_cell = require("./data_grid_cell");
|
|
27
|
+
|
|
28
|
+
var _react2 = require("@emotion/react");
|
|
29
|
+
|
|
30
|
+
var _excluded = ["colIndex", "visibleRowIndex", "style", "schema", "schemaDetectors", "pagination", "columns", "leadingControlColumns", "trailingControlColumns", "visibleColCount", "columnWidths", "defaultColumnWidth", "renderCellValue", "renderCellPopover", "interactiveCellId", "setRowHeight", "rowHeightsOptions", "rowHeightUtils", "rowManager"];
|
|
31
|
+
|
|
32
|
+
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); }
|
|
33
|
+
|
|
34
|
+
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; }
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* A DRY wrapper used by both custom and virtualized grid cells.
|
|
38
|
+
* It grabs context, determines the type of cell being rendered
|
|
39
|
+
* (e.g. control vs data cell), & sets shared props between all cells
|
|
40
|
+
*/
|
|
41
|
+
var Cell = function Cell(_ref) {
|
|
42
|
+
var colIndex = _ref.colIndex,
|
|
43
|
+
visibleRowIndex = _ref.visibleRowIndex,
|
|
44
|
+
style = _ref.style,
|
|
45
|
+
schema = _ref.schema,
|
|
46
|
+
schemaDetectors = _ref.schemaDetectors,
|
|
47
|
+
pagination = _ref.pagination,
|
|
48
|
+
columns = _ref.columns,
|
|
49
|
+
leadingControlColumns = _ref.leadingControlColumns,
|
|
50
|
+
trailingControlColumns = _ref.trailingControlColumns,
|
|
51
|
+
visibleColCount = _ref.visibleColCount,
|
|
52
|
+
columnWidths = _ref.columnWidths,
|
|
53
|
+
defaultColumnWidth = _ref.defaultColumnWidth,
|
|
54
|
+
renderCellValue = _ref.renderCellValue,
|
|
55
|
+
renderCellPopover = _ref.renderCellPopover,
|
|
56
|
+
interactiveCellId = _ref.interactiveCellId,
|
|
57
|
+
setRowHeight = _ref.setRowHeight,
|
|
58
|
+
rowHeightsOptions = _ref.rowHeightsOptions,
|
|
59
|
+
rowHeightUtils = _ref.rowHeightUtils,
|
|
60
|
+
rowManager = _ref.rowManager,
|
|
61
|
+
rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
62
|
+
var popoverContext = (0, _react.useContext)(_data_grid_cell_popover.DataGridCellPopoverContext);
|
|
63
|
+
|
|
64
|
+
var _useContext = (0, _react.useContext)(_sorting.DataGridSortingContext),
|
|
65
|
+
getCorrectRowIndex = _useContext.getCorrectRowIndex;
|
|
66
|
+
|
|
67
|
+
var cellContent;
|
|
68
|
+
var isFirstColumn = colIndex === 0;
|
|
69
|
+
var isLastColumn = colIndex === visibleColCount - 1;
|
|
70
|
+
var isLeadingControlColumn = colIndex < leadingControlColumns.length;
|
|
71
|
+
var isTrailingControlColumn = colIndex >= leadingControlColumns.length + columns.length;
|
|
72
|
+
var datacolIndex = colIndex - leadingControlColumns.length;
|
|
73
|
+
var column = columns[datacolIndex];
|
|
74
|
+
var columnId = column === null || column === void 0 ? void 0 : column.id;
|
|
75
|
+
var textTransform = (0, _react.useMemo)(function () {
|
|
76
|
+
var _schemaDetectors$filt;
|
|
77
|
+
|
|
78
|
+
return (_schemaDetectors$filt = schemaDetectors.filter(function (row) {
|
|
79
|
+
return column !== null && column !== void 0 && column.schema ? (column === null || column === void 0 ? void 0 : column.schema) === row.type : columnId === row.type;
|
|
80
|
+
})[0]) === null || _schemaDetectors$filt === void 0 ? void 0 : _schemaDetectors$filt.textTransform;
|
|
81
|
+
}, [columnId, column === null || column === void 0 ? void 0 : column.schema, schemaDetectors]);
|
|
82
|
+
var classes = (0, _classnames.default)((0, _defineProperty2.default)({
|
|
83
|
+
'euiDataGridRowCell--firstColumn': isFirstColumn,
|
|
84
|
+
'euiDataGridRowCell--lastColumn': isLastColumn,
|
|
85
|
+
'euiDataGridRowCell--controlColumn': isLeadingControlColumn || isTrailingControlColumn
|
|
86
|
+
}, "euiDataGridRowCell--".concat(textTransform), textTransform));
|
|
87
|
+
var sharedCellProps = {
|
|
88
|
+
rowIndex: getCorrectRowIndex(visibleRowIndex),
|
|
89
|
+
visibleRowIndex: visibleRowIndex,
|
|
90
|
+
colIndex: colIndex,
|
|
91
|
+
interactiveCellId: interactiveCellId,
|
|
92
|
+
className: classes,
|
|
93
|
+
style: style,
|
|
94
|
+
rowHeightsOptions: rowHeightsOptions,
|
|
95
|
+
rowHeightUtils: rowHeightUtils,
|
|
96
|
+
setRowHeight: isFirstColumn ? setRowHeight : undefined,
|
|
97
|
+
rowManager: rowManager,
|
|
98
|
+
popoverContext: popoverContext,
|
|
99
|
+
pagination: pagination
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
if (isLeadingControlColumn) {
|
|
103
|
+
var leadingColumn = leadingControlColumns[colIndex];
|
|
104
|
+
var id = leadingColumn.id,
|
|
105
|
+
rowCellRender = leadingColumn.rowCellRender;
|
|
106
|
+
cellContent = (0, _react2.jsx)(_data_grid_cell.EuiDataGridCell, (0, _extends2.default)({}, sharedCellProps, {
|
|
107
|
+
columnId: id,
|
|
108
|
+
width: leadingColumn.width,
|
|
109
|
+
renderCellValue: rowCellRender,
|
|
110
|
+
isExpandable: false
|
|
111
|
+
}, rest));
|
|
112
|
+
} else if (isTrailingControlColumn) {
|
|
113
|
+
var columnOffset = columns.length + leadingControlColumns.length;
|
|
114
|
+
var trailingcolIndex = colIndex - columnOffset;
|
|
115
|
+
var trailingColumn = trailingControlColumns[trailingcolIndex];
|
|
116
|
+
var _id = trailingColumn.id,
|
|
117
|
+
_rowCellRender = trailingColumn.rowCellRender;
|
|
118
|
+
cellContent = (0, _react2.jsx)(_data_grid_cell.EuiDataGridCell, (0, _extends2.default)({}, sharedCellProps, {
|
|
119
|
+
columnId: _id,
|
|
120
|
+
width: trailingColumn.width,
|
|
121
|
+
renderCellValue: _rowCellRender,
|
|
122
|
+
isExpandable: false
|
|
123
|
+
}, rest));
|
|
124
|
+
} else {
|
|
125
|
+
// this is a normal data cell
|
|
126
|
+
var columnType = schema[columnId] ? schema[columnId].columnType : null;
|
|
127
|
+
var isExpandable = column.isExpandable !== undefined ? column.isExpandable : true;
|
|
128
|
+
var width = columnWidths[columnId] || defaultColumnWidth;
|
|
129
|
+
cellContent = (0, _react2.jsx)(_data_grid_cell.EuiDataGridCell, (0, _extends2.default)({}, sharedCellProps, {
|
|
130
|
+
columnId: columnId,
|
|
131
|
+
column: column,
|
|
132
|
+
columnType: columnType,
|
|
133
|
+
width: width || undefined,
|
|
134
|
+
renderCellValue: renderCellValue,
|
|
135
|
+
renderCellPopover: renderCellPopover,
|
|
136
|
+
interactiveCellId: interactiveCellId,
|
|
137
|
+
isExpandable: isExpandable
|
|
138
|
+
}, rest));
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
return cellContent;
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
exports.Cell = Cell;
|
|
@@ -21,6 +21,8 @@ var _data_grid_control_header_cell = require("./data_grid_control_header_cell");
|
|
|
21
21
|
|
|
22
22
|
var _data_grid_header_cell = require("./data_grid_header_cell");
|
|
23
23
|
|
|
24
|
+
var _data_grid_types = require("../../data_grid_types");
|
|
25
|
+
|
|
24
26
|
var _react2 = require("@emotion/react");
|
|
25
27
|
|
|
26
28
|
var _excluded = ["leadingControlColumns", "trailingControlColumns", "columns", "schema", "schemaDetectors", "columnWidths", "defaultColumnWidth", "className", "setColumnWidth", "setVisibleColumns", "switchColumnPos", "headerIsInteractive", "data-test-subj"];
|
|
@@ -31,9 +33,9 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
31
33
|
|
|
32
34
|
var EuiDataGridHeaderRow = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
33
35
|
var _props$leadingControl = props.leadingControlColumns,
|
|
34
|
-
leadingControlColumns = _props$leadingControl === void 0 ?
|
|
36
|
+
leadingControlColumns = _props$leadingControl === void 0 ? _data_grid_types.emptyControlColumns : _props$leadingControl,
|
|
35
37
|
_props$trailingContro = props.trailingControlColumns,
|
|
36
|
-
trailingControlColumns = _props$trailingContro === void 0 ?
|
|
38
|
+
trailingControlColumns = _props$trailingContro === void 0 ? _data_grid_types.emptyControlColumns : _props$trailingContro,
|
|
37
39
|
columns = props.columns,
|
|
38
40
|
schema = props.schema,
|
|
39
41
|
schemaDetectors = props.schemaDetectors,
|
|
@@ -55,9 +55,11 @@ var _data_grid_schema = require("./utils/data_grid_schema");
|
|
|
55
55
|
|
|
56
56
|
var _ref = require("./utils/ref");
|
|
57
57
|
|
|
58
|
+
var _data_grid_types = require("./data_grid_types");
|
|
59
|
+
|
|
58
60
|
var _react2 = require("@emotion/react");
|
|
59
61
|
|
|
60
|
-
var _excluded = ["leadingControlColumns", "trailingControlColumns", "columns", "columnVisibility", "schemaDetectors", "rowCount", "renderCellValue", "renderCellPopover", "renderFooterCellValue", "className", "gridStyle", "toolbarVisibility", "pagination", "sorting", "inMemory", "onColumnResize", "minSizeForControls", "height", "width", "rowHeightsOptions", "virtualizationOptions"],
|
|
62
|
+
var _excluded = ["leadingControlColumns", "trailingControlColumns", "columns", "columnVisibility", "schemaDetectors", "rowCount", "renderCellValue", "renderCellPopover", "renderFooterCellValue", "className", "gridStyle", "toolbarVisibility", "pagination", "sorting", "inMemory", "onColumnResize", "minSizeForControls", "height", "width", "rowHeightsOptions", "virtualizationOptions", "renderCustomGridBody"],
|
|
61
63
|
_excluded2 = ["focusProps"];
|
|
62
64
|
|
|
63
65
|
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); }
|
|
@@ -101,9 +103,9 @@ var EuiDataGrid = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
101
103
|
var _gridItemsRendered$cu;
|
|
102
104
|
|
|
103
105
|
var _props$leadingControl = props.leadingControlColumns,
|
|
104
|
-
leadingControlColumns = _props$leadingControl === void 0 ?
|
|
106
|
+
leadingControlColumns = _props$leadingControl === void 0 ? _data_grid_types.emptyControlColumns : _props$leadingControl,
|
|
105
107
|
_props$trailingContro = props.trailingControlColumns,
|
|
106
|
-
trailingControlColumns = _props$trailingContro === void 0 ?
|
|
108
|
+
trailingControlColumns = _props$trailingContro === void 0 ? _data_grid_types.emptyControlColumns : _props$trailingContro,
|
|
107
109
|
columns = props.columns,
|
|
108
110
|
columnVisibility = props.columnVisibility,
|
|
109
111
|
schemaDetectors = props.schemaDetectors,
|
|
@@ -124,6 +126,7 @@ var EuiDataGrid = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
124
126
|
width = props.width,
|
|
125
127
|
_rowHeightsOptions = props.rowHeightsOptions,
|
|
126
128
|
virtualizationOptions = props.virtualizationOptions,
|
|
129
|
+
renderCustomGridBody = props.renderCustomGridBody,
|
|
127
130
|
rest = (0, _objectWithoutProperties2.default)(props, _excluded);
|
|
128
131
|
/**
|
|
129
132
|
* Merge consumer settings with defaults
|
|
@@ -400,7 +403,8 @@ var EuiDataGrid = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
400
403
|
gridWidth: gridWidth,
|
|
401
404
|
gridRef: gridRef,
|
|
402
405
|
gridItemsRendered: gridItemsRendered,
|
|
403
|
-
wrapperRef: contentRef
|
|
406
|
+
wrapperRef: contentRef,
|
|
407
|
+
renderCustomGridBody: renderCustomGridBody
|
|
404
408
|
})), pagination && props['aria-labelledby'] && (0, _react2.jsx)("p", {
|
|
405
409
|
id: ariaLabelledById,
|
|
406
410
|
hidden: true
|
|
@@ -2,4 +2,25 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
|
-
});
|
|
5
|
+
});
|
|
6
|
+
exports.emptyControlColumns = void 0;
|
|
7
|
+
|
|
8
|
+
/*
|
|
9
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
10
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
11
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
12
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
13
|
+
* Side Public License, v 1.
|
|
14
|
+
*/
|
|
15
|
+
// since react-window doesn't export a type with the imperative api only we can
|
|
16
|
+
// use this to omit the react-specific class component methods
|
|
17
|
+
// An array of [x,y] coordinates. Note that the `y` value expected internally is a `visibleRowIndex`
|
|
18
|
+
// Force either aria-label or aria-labelledby to be defined
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Props shared between renderCellValue and renderCellPopover
|
|
22
|
+
*/
|
|
23
|
+
// The empty control column array fallbacks need to be cached, or
|
|
24
|
+
// they'll cause rerendering/remount issues in memoized dependencies
|
|
25
|
+
var emptyControlColumns = [];
|
|
26
|
+
exports.emptyControlColumns = emptyControlColumns;
|