@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
|
@@ -1,9 +1,18 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
+
import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
|
|
3
|
+
import _get from "@babel/runtime/helpers/get";
|
|
4
|
+
import _inherits from "@babel/runtime/helpers/inherits";
|
|
5
|
+
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
6
|
+
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
2
7
|
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
3
8
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
4
9
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
5
10
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
6
11
|
|
|
12
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
13
|
+
|
|
14
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
15
|
+
|
|
7
16
|
/*
|
|
8
17
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
9
18
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
@@ -24,16 +33,11 @@ export var cellPaddingsMap = {
|
|
|
24
33
|
export var AUTO_HEIGHT = 'auto';
|
|
25
34
|
export var DEFAULT_ROW_HEIGHT = 34;
|
|
26
35
|
export var RowHeightUtils = /*#__PURE__*/function () {
|
|
27
|
-
function RowHeightUtils(
|
|
36
|
+
function RowHeightUtils() {
|
|
28
37
|
var _this = this;
|
|
29
38
|
|
|
30
39
|
_classCallCheck(this, RowHeightUtils);
|
|
31
40
|
|
|
32
|
-
this.gridRef = gridRef;
|
|
33
|
-
this.outerGridElementRef = outerGridElementRef;
|
|
34
|
-
this.gridItemsRenderedRef = gridItemsRenderedRef;
|
|
35
|
-
this.rerenderGridBodyRef = rerenderGridBodyRef;
|
|
36
|
-
|
|
37
41
|
_defineProperty(this, "styles", {
|
|
38
42
|
paddingTop: 0,
|
|
39
43
|
paddingBottom: 0
|
|
@@ -65,10 +69,6 @@ export var RowHeightUtils = /*#__PURE__*/function () {
|
|
|
65
69
|
});
|
|
66
70
|
|
|
67
71
|
_defineProperty(this, "heightsCache", new Map());
|
|
68
|
-
|
|
69
|
-
_defineProperty(this, "timerId", void 0);
|
|
70
|
-
|
|
71
|
-
_defineProperty(this, "lastUpdatedRow", Infinity);
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
_createClass(RowHeightUtils, [{
|
|
@@ -154,6 +154,11 @@ export var RowHeightUtils = /*#__PURE__*/function () {
|
|
|
154
154
|
|
|
155
155
|
return false;
|
|
156
156
|
}
|
|
157
|
+
/**
|
|
158
|
+
* Heights cache utils
|
|
159
|
+
* This cache is primarily used by auto heights & secondarily used by lineCount row overrides
|
|
160
|
+
*/
|
|
161
|
+
|
|
157
162
|
}, {
|
|
158
163
|
key: "getRowHeight",
|
|
159
164
|
value: function getRowHeight(rowIndex) {
|
|
@@ -166,23 +171,20 @@ export var RowHeightUtils = /*#__PURE__*/function () {
|
|
|
166
171
|
}, {
|
|
167
172
|
key: "setRowHeight",
|
|
168
173
|
value: function setRowHeight(rowIndex, colId) {
|
|
169
|
-
var _this$rerenderGridBod, _this$rerenderGridBod2;
|
|
170
|
-
|
|
171
174
|
var height = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : DEFAULT_ROW_HEIGHT;
|
|
172
|
-
|
|
175
|
+
|
|
176
|
+
var _visibleRowIndex = arguments.length > 3 ? arguments[3] : undefined;
|
|
177
|
+
|
|
173
178
|
var rowHeights = this.heightsCache.get(rowIndex) || new Map();
|
|
174
179
|
var adaptedHeight = Math.ceil(height + this.styles.paddingTop + this.styles.paddingBottom);
|
|
175
180
|
|
|
176
181
|
if (rowHeights.get(colId) === adaptedHeight) {
|
|
177
|
-
return;
|
|
182
|
+
return false;
|
|
183
|
+
} else {
|
|
184
|
+
rowHeights.set(colId, adaptedHeight);
|
|
185
|
+
this.heightsCache.set(rowIndex, rowHeights);
|
|
186
|
+
return true;
|
|
178
187
|
}
|
|
179
|
-
|
|
180
|
-
rowHeights.set(colId, adaptedHeight);
|
|
181
|
-
this.heightsCache.set(rowIndex, rowHeights);
|
|
182
|
-
this.resetRow(visibleRowIndex); // When an auto row height is updated, force a re-render
|
|
183
|
-
// of the grid body to update the unconstrained height
|
|
184
|
-
|
|
185
|
-
(_this$rerenderGridBod = (_this$rerenderGridBod2 = this.rerenderGridBodyRef).current) === null || _this$rerenderGridBod === void 0 ? void 0 : _this$rerenderGridBod.call(_this$rerenderGridBod2);
|
|
186
188
|
}
|
|
187
189
|
}, {
|
|
188
190
|
key: "pruneHiddenColumnHeights",
|
|
@@ -201,22 +203,84 @@ export var RowHeightUtils = /*#__PURE__*/function () {
|
|
|
201
203
|
}
|
|
202
204
|
});
|
|
203
205
|
});
|
|
206
|
+
return didModify;
|
|
207
|
+
}
|
|
208
|
+
}]);
|
|
209
|
+
|
|
210
|
+
return RowHeightUtils;
|
|
211
|
+
}();
|
|
212
|
+
/**
|
|
213
|
+
* Row height utils with virtualization library-specific APIs
|
|
214
|
+
*/
|
|
215
|
+
|
|
216
|
+
export var RowHeightVirtualizationUtils = /*#__PURE__*/function (_RowHeightUtils) {
|
|
217
|
+
_inherits(RowHeightVirtualizationUtils, _RowHeightUtils);
|
|
218
|
+
|
|
219
|
+
var _super = _createSuper(RowHeightVirtualizationUtils);
|
|
220
|
+
|
|
221
|
+
function RowHeightVirtualizationUtils(gridRef, outerGridElementRef, gridItemsRenderedRef, rerenderGridBodyRef) {
|
|
222
|
+
var _this2;
|
|
223
|
+
|
|
224
|
+
_classCallCheck(this, RowHeightVirtualizationUtils);
|
|
225
|
+
|
|
226
|
+
_this2 = _super.call(this);
|
|
227
|
+
_this2.gridRef = gridRef;
|
|
228
|
+
_this2.outerGridElementRef = outerGridElementRef;
|
|
229
|
+
_this2.gridItemsRenderedRef = gridItemsRenderedRef;
|
|
230
|
+
_this2.rerenderGridBodyRef = rerenderGridBodyRef;
|
|
231
|
+
|
|
232
|
+
_defineProperty(_assertThisInitialized(_this2), "timerId", void 0);
|
|
233
|
+
|
|
234
|
+
_defineProperty(_assertThisInitialized(_this2), "lastUpdatedRow", Infinity);
|
|
235
|
+
|
|
236
|
+
return _this2;
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* Virtualization workarounds for auto height rows
|
|
240
|
+
*/
|
|
241
|
+
|
|
242
|
+
|
|
243
|
+
_createClass(RowHeightVirtualizationUtils, [{
|
|
244
|
+
key: "setRowHeight",
|
|
245
|
+
value: function setRowHeight(rowIndex, colId) {
|
|
246
|
+
var height = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : DEFAULT_ROW_HEIGHT;
|
|
247
|
+
var visibleRowIndex = arguments.length > 3 ? arguments[3] : undefined;
|
|
248
|
+
|
|
249
|
+
var didModify = _get(_getPrototypeOf(RowHeightVirtualizationUtils.prototype), "setRowHeight", this).call(this, rowIndex, colId, height, visibleRowIndex); // When an auto row height is updated, force a re-render
|
|
250
|
+
// of the grid body to update the unconstrained height
|
|
251
|
+
|
|
252
|
+
|
|
253
|
+
if (didModify) {
|
|
254
|
+
var _this$rerenderGridBod, _this$rerenderGridBod2;
|
|
255
|
+
|
|
256
|
+
(_this$rerenderGridBod = (_this$rerenderGridBod2 = this.rerenderGridBodyRef).current) === null || _this$rerenderGridBod === void 0 ? void 0 : _this$rerenderGridBod.call(_this$rerenderGridBod2);
|
|
257
|
+
this.resetRow(visibleRowIndex);
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
return didModify; // Mostly just here for typing
|
|
261
|
+
}
|
|
262
|
+
}, {
|
|
263
|
+
key: "pruneHiddenColumnHeights",
|
|
264
|
+
value: function pruneHiddenColumnHeights(visibleColumns) {
|
|
265
|
+
var didModify = _get(_getPrototypeOf(RowHeightVirtualizationUtils.prototype), "pruneHiddenColumnHeights", this).call(this, visibleColumns);
|
|
204
266
|
|
|
205
267
|
if (didModify) {
|
|
206
268
|
this.resetRow(0);
|
|
207
269
|
}
|
|
270
|
+
|
|
271
|
+
return didModify; // Mostly just here for typing
|
|
208
272
|
}
|
|
209
273
|
}, {
|
|
210
274
|
key: "resetRow",
|
|
211
275
|
value: function resetRow(visibleRowIndex) {
|
|
212
|
-
var
|
|
276
|
+
var _this3 = this;
|
|
213
277
|
|
|
214
278
|
// save the first row index of batch, reassigning it only
|
|
215
279
|
// if this visible row index less than lastUpdatedRow
|
|
216
280
|
this.lastUpdatedRow = Math.min(this.lastUpdatedRow, visibleRowIndex);
|
|
217
281
|
clearTimeout(this.timerId);
|
|
218
282
|
this.timerId = window.setTimeout(function () {
|
|
219
|
-
return
|
|
283
|
+
return _this3.resetGrid();
|
|
220
284
|
}, 0);
|
|
221
285
|
}
|
|
222
286
|
}, {
|
|
@@ -254,24 +318,29 @@ export var RowHeightUtils = /*#__PURE__*/function () {
|
|
|
254
318
|
}
|
|
255
319
|
}]);
|
|
256
320
|
|
|
257
|
-
return
|
|
258
|
-
}();
|
|
321
|
+
return RowHeightVirtualizationUtils;
|
|
322
|
+
}(RowHeightUtils);
|
|
259
323
|
/**
|
|
260
324
|
* Hook for instantiating RowHeightUtils, setting internal class vars,
|
|
261
325
|
* and setting up various row-height-related side effects
|
|
262
326
|
*/
|
|
263
327
|
|
|
264
328
|
export var useRowHeightUtils = function useRowHeightUtils(_ref2) {
|
|
265
|
-
var
|
|
266
|
-
|
|
267
|
-
gridItemsRenderedRef = _ref2.gridItemsRenderedRef,
|
|
329
|
+
var virtualization = _ref2.virtualization,
|
|
330
|
+
rowHeightsOptions = _ref2.rowHeightsOptions,
|
|
268
331
|
gridStyles = _ref2.gridStyles,
|
|
269
|
-
columns = _ref2.columns
|
|
270
|
-
rowHeightsOptions = _ref2.rowHeightsOptions;
|
|
332
|
+
columns = _ref2.columns;
|
|
271
333
|
var forceRenderRef = useLatest(useForceRender());
|
|
272
334
|
|
|
273
335
|
var _useState = useState(function () {
|
|
274
|
-
|
|
336
|
+
if (virtualization) {
|
|
337
|
+
var _gridRef = virtualization.gridRef,
|
|
338
|
+
_outerGridElementRef = virtualization.outerGridElementRef,
|
|
339
|
+
_gridItemsRenderedRef = virtualization.gridItemsRenderedRef;
|
|
340
|
+
return new RowHeightVirtualizationUtils(_gridRef, _outerGridElementRef, _gridItemsRenderedRef, forceRenderRef);
|
|
341
|
+
} else {
|
|
342
|
+
return new RowHeightUtils();
|
|
343
|
+
}
|
|
275
344
|
}),
|
|
276
345
|
_useState2 = _slicedToArray(_useState, 1),
|
|
277
346
|
rowHeightUtils = _useState2[0]; // Forces a rerender whenever the row heights change, as this can cause the
|
|
@@ -415,6 +415,8 @@ export var typeToPathMap = {
|
|
|
415
415
|
visVisualBuilder: 'vis_visual_builder',
|
|
416
416
|
visualizeApp: 'app_visualize',
|
|
417
417
|
warning: 'warning',
|
|
418
|
+
alert: 'warning',
|
|
419
|
+
// NOTE: This is an undocumented alias for `warning`, added for legacy compatability with Elastic Charts
|
|
418
420
|
watchesApp: 'app_watches',
|
|
419
421
|
wordWrap: 'wordWrap',
|
|
420
422
|
wordWrapDisabled: 'wordWrapDisabled',
|
|
@@ -2,430 +2,37 @@
|
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
4
|
|
|
5
|
-
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
-
|
|
7
5
|
Object.defineProperty(exports, "__esModule", {
|
|
8
6
|
value: true
|
|
9
7
|
});
|
|
10
|
-
exports.EuiDataGridBody =
|
|
11
|
-
|
|
12
|
-
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
8
|
+
exports.EuiDataGridBody = void 0;
|
|
13
9
|
|
|
14
10
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
15
11
|
|
|
16
|
-
var
|
|
17
|
-
|
|
18
|
-
var _classnames = _interopRequireDefault(require("classnames"));
|
|
19
|
-
|
|
20
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
21
|
-
|
|
22
|
-
var _reactWindow = require("react-window");
|
|
23
|
-
|
|
24
|
-
var _resize_observer = require("../../observer/resize_observer");
|
|
25
|
-
|
|
26
|
-
var _data_grid_cell = require("./data_grid_cell");
|
|
27
|
-
|
|
28
|
-
var _header = require("./header");
|
|
29
|
-
|
|
30
|
-
var _footer = require("./footer");
|
|
31
|
-
|
|
32
|
-
var _data_grid_cell_popover = require("./data_grid_cell_popover");
|
|
33
|
-
|
|
34
|
-
var _data_grid_row_manager = require("./data_grid_row_manager");
|
|
35
|
-
|
|
36
|
-
var _grid_height_width = require("../utils/grid_height_width");
|
|
37
|
-
|
|
38
|
-
var _col_widths = require("../utils/col_widths");
|
|
39
|
-
|
|
40
|
-
var _row_heights = require("../utils/row_heights");
|
|
12
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
41
13
|
|
|
42
|
-
var
|
|
14
|
+
var _react = _interopRequireDefault(require("react"));
|
|
43
15
|
|
|
44
|
-
var
|
|
16
|
+
var _data_grid_body_virtualized = require("./data_grid_body_virtualized");
|
|
45
17
|
|
|
46
|
-
var
|
|
18
|
+
var _data_grid_body_custom = require("./data_grid_body_custom");
|
|
47
19
|
|
|
48
20
|
var _react2 = require("@emotion/react");
|
|
49
21
|
|
|
50
|
-
var _excluded = ["
|
|
51
|
-
|
|
52
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
53
|
-
|
|
54
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
55
|
-
|
|
56
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
57
|
-
|
|
58
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
59
|
-
|
|
60
|
-
var Cell = function Cell(_ref) {
|
|
61
|
-
var columnIndex = _ref.columnIndex,
|
|
62
|
-
visibleRowIndex = _ref.rowIndex,
|
|
63
|
-
style = _ref.style,
|
|
64
|
-
data = _ref.data;
|
|
65
|
-
var leadingControlColumns = data.leadingControlColumns,
|
|
66
|
-
trailingControlColumns = data.trailingControlColumns,
|
|
67
|
-
columns = data.columns,
|
|
68
|
-
visibleColCount = data.visibleColCount,
|
|
69
|
-
schema = data.schema,
|
|
70
|
-
columnWidths = data.columnWidths,
|
|
71
|
-
defaultColumnWidth = data.defaultColumnWidth,
|
|
72
|
-
renderCellValue = data.renderCellValue,
|
|
73
|
-
renderCellPopover = data.renderCellPopover,
|
|
74
|
-
interactiveCellId = data.interactiveCellId,
|
|
75
|
-
setRowHeight = data.setRowHeight,
|
|
76
|
-
schemaDetectors = data.schemaDetectors,
|
|
77
|
-
rowHeightsOptions = data.rowHeightsOptions,
|
|
78
|
-
rowHeightUtils = data.rowHeightUtils,
|
|
79
|
-
rowManager = data.rowManager,
|
|
80
|
-
pagination = data.pagination;
|
|
81
|
-
var popoverContext = (0, _react.useContext)(_data_grid_cell_popover.DataGridCellPopoverContext);
|
|
82
|
-
|
|
83
|
-
var _useContext = (0, _react.useContext)(DataGridWrapperRowsContext),
|
|
84
|
-
headerRowHeight = _useContext.headerRowHeight;
|
|
85
|
-
|
|
86
|
-
var _useContext2 = (0, _react.useContext)(_sorting.DataGridSortingContext),
|
|
87
|
-
getCorrectRowIndex = _useContext2.getCorrectRowIndex;
|
|
88
|
-
|
|
89
|
-
var cellContent;
|
|
90
|
-
var isFirstColumn = columnIndex === 0;
|
|
91
|
-
var isLastColumn = columnIndex === visibleColCount - 1;
|
|
92
|
-
var isLeadingControlColumn = columnIndex < leadingControlColumns.length;
|
|
93
|
-
var isTrailingControlColumn = columnIndex >= leadingControlColumns.length + columns.length;
|
|
94
|
-
var dataColumnIndex = columnIndex - leadingControlColumns.length;
|
|
95
|
-
var column = columns[dataColumnIndex];
|
|
96
|
-
var columnId = column === null || column === void 0 ? void 0 : column.id;
|
|
97
|
-
var transformClass = schemaDetectors.filter(function (row) {
|
|
98
|
-
return column !== null && column !== void 0 && column.schema ? (column === null || column === void 0 ? void 0 : column.schema) === row.type : columnId === row.type;
|
|
99
|
-
})[0];
|
|
100
|
-
var textTransform = transformClass === null || transformClass === void 0 ? void 0 : transformClass.textTransform;
|
|
101
|
-
var classes = (0, _classnames.default)((0, _defineProperty2.default)({
|
|
102
|
-
'euiDataGridRowCell--firstColumn': isFirstColumn,
|
|
103
|
-
'euiDataGridRowCell--lastColumn': isLastColumn,
|
|
104
|
-
'euiDataGridRowCell--controlColumn': isLeadingControlColumn || isTrailingControlColumn
|
|
105
|
-
}, "euiDataGridRowCell--".concat(textTransform), textTransform));
|
|
106
|
-
var sharedCellProps = {
|
|
107
|
-
rowIndex: getCorrectRowIndex(visibleRowIndex),
|
|
108
|
-
visibleRowIndex: visibleRowIndex,
|
|
109
|
-
colIndex: columnIndex,
|
|
110
|
-
interactiveCellId: interactiveCellId,
|
|
111
|
-
className: classes,
|
|
112
|
-
style: _objectSpread(_objectSpread({}, style), {}, {
|
|
113
|
-
top: "".concat(parseFloat(style.top) + headerRowHeight, "px")
|
|
114
|
-
}),
|
|
115
|
-
rowHeightsOptions: rowHeightsOptions,
|
|
116
|
-
rowHeightUtils: rowHeightUtils,
|
|
117
|
-
setRowHeight: isFirstColumn ? setRowHeight : undefined,
|
|
118
|
-
rowManager: rowManager,
|
|
119
|
-
popoverContext: popoverContext,
|
|
120
|
-
pagination: pagination
|
|
121
|
-
};
|
|
122
|
-
|
|
123
|
-
if (isLeadingControlColumn) {
|
|
124
|
-
var leadingColumn = leadingControlColumns[columnIndex];
|
|
125
|
-
var id = leadingColumn.id,
|
|
126
|
-
rowCellRender = leadingColumn.rowCellRender;
|
|
127
|
-
cellContent = (0, _react2.jsx)(_data_grid_cell.EuiDataGridCell, (0, _extends2.default)({}, sharedCellProps, {
|
|
128
|
-
columnId: id,
|
|
129
|
-
width: leadingColumn.width,
|
|
130
|
-
renderCellValue: rowCellRender,
|
|
131
|
-
isExpandable: false
|
|
132
|
-
}));
|
|
133
|
-
} else if (isTrailingControlColumn) {
|
|
134
|
-
var columnOffset = columns.length + leadingControlColumns.length;
|
|
135
|
-
var trailingColumnIndex = columnIndex - columnOffset;
|
|
136
|
-
var trailingColumn = trailingControlColumns[trailingColumnIndex];
|
|
137
|
-
var _id = trailingColumn.id,
|
|
138
|
-
_rowCellRender = trailingColumn.rowCellRender;
|
|
139
|
-
cellContent = (0, _react2.jsx)(_data_grid_cell.EuiDataGridCell, (0, _extends2.default)({}, sharedCellProps, {
|
|
140
|
-
columnId: _id,
|
|
141
|
-
width: trailingColumn.width,
|
|
142
|
-
renderCellValue: _rowCellRender,
|
|
143
|
-
isExpandable: false
|
|
144
|
-
}));
|
|
145
|
-
} else {
|
|
146
|
-
// this is a normal data cell
|
|
147
|
-
var columnType = schema[columnId] ? schema[columnId].columnType : null;
|
|
148
|
-
var isExpandable = column.isExpandable !== undefined ? column.isExpandable : true;
|
|
149
|
-
var width = columnWidths[columnId] || defaultColumnWidth;
|
|
150
|
-
cellContent = (0, _react2.jsx)(_data_grid_cell.EuiDataGridCell, (0, _extends2.default)({}, sharedCellProps, {
|
|
151
|
-
columnId: columnId,
|
|
152
|
-
column: column,
|
|
153
|
-
columnType: columnType,
|
|
154
|
-
width: width || undefined,
|
|
155
|
-
renderCellValue: renderCellValue,
|
|
156
|
-
renderCellPopover: renderCellPopover,
|
|
157
|
-
interactiveCellId: interactiveCellId,
|
|
158
|
-
isExpandable: isExpandable
|
|
159
|
-
}));
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
return cellContent;
|
|
163
|
-
}; // Context is required to pass props to react-window's innerElementType
|
|
164
|
-
// @see https://github.com/bvaughn/react-window/issues/404
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
exports.Cell = Cell;
|
|
168
|
-
var DataGridWrapperRowsContext = /*#__PURE__*/(0, _react.createContext)({
|
|
169
|
-
headerRow: (0, _react2.jsx)("div", null),
|
|
170
|
-
headerRowHeight: 0,
|
|
171
|
-
footerRow: null
|
|
172
|
-
});
|
|
173
|
-
exports.DataGridWrapperRowsContext = DataGridWrapperRowsContext;
|
|
174
|
-
var InnerElement = /*#__PURE__*/(0, _react.forwardRef)(function (_ref2, ref) {
|
|
175
|
-
var children = _ref2.children,
|
|
176
|
-
style = _ref2.style,
|
|
177
|
-
rest = (0, _objectWithoutProperties2.default)(_ref2, _excluded);
|
|
178
|
-
|
|
179
|
-
var _useContext3 = (0, _react.useContext)(DataGridWrapperRowsContext),
|
|
180
|
-
headerRowHeight = _useContext3.headerRowHeight,
|
|
181
|
-
headerRow = _useContext3.headerRow,
|
|
182
|
-
footerRow = _useContext3.footerRow;
|
|
183
|
-
|
|
184
|
-
return (0, _react2.jsx)(_react.default.Fragment, null, (0, _react2.jsx)("div", (0, _extends2.default)({
|
|
185
|
-
ref: ref,
|
|
186
|
-
style: _objectSpread(_objectSpread({}, style), {}, {
|
|
187
|
-
height: style.height + headerRowHeight
|
|
188
|
-
})
|
|
189
|
-
}, rest), headerRow, children), footerRow);
|
|
190
|
-
});
|
|
191
|
-
InnerElement.displayName = 'EuiDataGridInnerElement';
|
|
192
|
-
|
|
193
|
-
var EuiDataGridBody = function EuiDataGridBody(props) {
|
|
194
|
-
var leadingControlColumns = props.leadingControlColumns,
|
|
195
|
-
trailingControlColumns = props.trailingControlColumns,
|
|
196
|
-
columns = props.columns,
|
|
197
|
-
visibleColCount = props.visibleColCount,
|
|
198
|
-
schema = props.schema,
|
|
199
|
-
schemaDetectors = props.schemaDetectors,
|
|
200
|
-
rowCount = props.rowCount,
|
|
201
|
-
_props$visibleRows = props.visibleRows,
|
|
202
|
-
startRow = _props$visibleRows.startRow,
|
|
203
|
-
endRow = _props$visibleRows.endRow,
|
|
204
|
-
visibleRowCount = _props$visibleRows.visibleRowCount,
|
|
205
|
-
renderCellValue = props.renderCellValue,
|
|
206
|
-
renderCellPopover = props.renderCellPopover,
|
|
207
|
-
renderFooterCellValue = props.renderFooterCellValue,
|
|
208
|
-
interactiveCellId = props.interactiveCellId,
|
|
209
|
-
pagination = props.pagination,
|
|
210
|
-
headerIsInteractive = props.headerIsInteractive,
|
|
211
|
-
handleHeaderMutation = props.handleHeaderMutation,
|
|
212
|
-
setVisibleColumns = props.setVisibleColumns,
|
|
213
|
-
switchColumnPos = props.switchColumnPos,
|
|
214
|
-
onColumnResize = props.onColumnResize,
|
|
215
|
-
rowHeightsOptions = props.rowHeightsOptions,
|
|
216
|
-
virtualizationOptions = props.virtualizationOptions,
|
|
217
|
-
isFullScreen = props.isFullScreen,
|
|
218
|
-
gridStyles = props.gridStyles,
|
|
219
|
-
gridWidth = props.gridWidth,
|
|
220
|
-
gridRef = props.gridRef,
|
|
221
|
-
gridItemsRendered = props.gridItemsRendered,
|
|
222
|
-
wrapperRef = props.wrapperRef;
|
|
223
|
-
/**
|
|
224
|
-
* Grid refs & observers
|
|
225
|
-
*/
|
|
226
|
-
|
|
227
|
-
var wrapperDimensions = (0, _resize_observer.useResizeObserver)(wrapperRef.current);
|
|
228
|
-
var outerGridRef = (0, _react.useRef)(null); // container that becomes scrollable
|
|
229
|
-
|
|
230
|
-
var innerGridRef = (0, _react.useRef)(null); // container sized to fit all content
|
|
231
|
-
|
|
232
|
-
/**
|
|
233
|
-
* Scroll bars
|
|
234
|
-
*/
|
|
235
|
-
|
|
236
|
-
var _useScrollBars = (0, _scrolling.useScrollBars)(outerGridRef, gridStyles.border),
|
|
237
|
-
scrollBarHeight = _useScrollBars.scrollBarHeight,
|
|
238
|
-
hasVerticalScroll = _useScrollBars.hasVerticalScroll,
|
|
239
|
-
hasHorizontalScroll = _useScrollBars.hasHorizontalScroll,
|
|
240
|
-
scrollBorderOverlay = _useScrollBars.scrollBorderOverlay;
|
|
241
|
-
/**
|
|
242
|
-
* Widths
|
|
243
|
-
*/
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
var virtualizeContainerWidth = (0, _grid_height_width.useVirtualizeContainerWidth)(outerGridRef.current, gridWidth, pagination === null || pagination === void 0 ? void 0 : pagination.pageSize); // compute the default column width from the container's width and count of visible columns
|
|
247
|
-
|
|
248
|
-
var defaultColumnWidth = (0, _col_widths.useDefaultColumnWidth)(virtualizeContainerWidth, leadingControlColumns, trailingControlColumns, columns);
|
|
249
|
-
|
|
250
|
-
var _useColumnWidths = (0, _col_widths.useColumnWidths)({
|
|
251
|
-
columns: columns,
|
|
252
|
-
leadingControlColumns: leadingControlColumns,
|
|
253
|
-
trailingControlColumns: trailingControlColumns,
|
|
254
|
-
defaultColumnWidth: defaultColumnWidth,
|
|
255
|
-
onColumnResize: onColumnResize
|
|
256
|
-
}),
|
|
257
|
-
columnWidths = _useColumnWidths.columnWidths,
|
|
258
|
-
setColumnWidth = _useColumnWidths.setColumnWidth,
|
|
259
|
-
getColumnWidth = _useColumnWidths.getColumnWidth;
|
|
260
|
-
/**
|
|
261
|
-
* Header & footer
|
|
262
|
-
*/
|
|
22
|
+
var _excluded = ["renderCustomGridBody"];
|
|
263
23
|
|
|
24
|
+
var EuiDataGridBody = function EuiDataGridBody(_ref) {
|
|
25
|
+
var renderCustomGridBody = _ref.renderCustomGridBody,
|
|
26
|
+
props = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
264
27
|
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
setVisibleColumns: setVisibleColumns,
|
|
270
|
-
leadingControlColumns: leadingControlColumns,
|
|
271
|
-
trailingControlColumns: trailingControlColumns,
|
|
272
|
-
columns: columns,
|
|
273
|
-
columnWidths: columnWidths,
|
|
274
|
-
defaultColumnWidth: defaultColumnWidth,
|
|
275
|
-
setColumnWidth: setColumnWidth,
|
|
276
|
-
schema: schema,
|
|
277
|
-
schemaDetectors: schemaDetectors
|
|
278
|
-
}),
|
|
279
|
-
headerRow = _useDataGridHeader.headerRow,
|
|
280
|
-
headerRowHeight = _useDataGridHeader.headerRowHeight;
|
|
281
|
-
|
|
282
|
-
var _useDataGridFooter = (0, _footer.useDataGridFooter)({
|
|
283
|
-
renderFooterCellValue: renderFooterCellValue,
|
|
284
|
-
renderCellPopover: renderCellPopover,
|
|
285
|
-
rowIndex: visibleRowCount,
|
|
286
|
-
visibleRowIndex: visibleRowCount,
|
|
287
|
-
interactiveCellId: interactiveCellId,
|
|
288
|
-
leadingControlColumns: leadingControlColumns,
|
|
289
|
-
trailingControlColumns: trailingControlColumns,
|
|
290
|
-
columns: columns,
|
|
291
|
-
columnWidths: columnWidths,
|
|
292
|
-
defaultColumnWidth: defaultColumnWidth,
|
|
293
|
-
schema: schema
|
|
294
|
-
}),
|
|
295
|
-
footerRow = _useDataGridFooter.footerRow,
|
|
296
|
-
footerRowHeight = _useDataGridFooter.footerRowHeight;
|
|
297
|
-
/**
|
|
298
|
-
* Handle scrolling cells fully into view
|
|
299
|
-
*/
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
(0, _scrolling.useScroll)({
|
|
303
|
-
gridRef: gridRef,
|
|
304
|
-
outerGridRef: outerGridRef,
|
|
305
|
-
hasGridScrolling: hasVerticalScroll || hasHorizontalScroll,
|
|
306
|
-
headerRowHeight: headerRowHeight,
|
|
307
|
-
footerRowHeight: footerRowHeight,
|
|
308
|
-
visibleRowCount: visibleRowCount,
|
|
309
|
-
hasStickyFooter: !!(renderFooterCellValue && gridStyles.stickyFooter)
|
|
310
|
-
});
|
|
311
|
-
/**
|
|
312
|
-
* Row manager
|
|
28
|
+
/*
|
|
29
|
+
* Determine whether we should use the default EuiDataGridBody
|
|
30
|
+
* + virtualization library for rendering content, or if consumers have
|
|
31
|
+
* passed their own custom renderer
|
|
313
32
|
*/
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
rowClasses: gridStyles.rowClasses
|
|
318
|
-
});
|
|
319
|
-
/**
|
|
320
|
-
* Heights
|
|
321
|
-
*/
|
|
322
|
-
|
|
323
|
-
var rowHeightUtils = (0, _row_heights.useRowHeightUtils)({
|
|
324
|
-
gridRef: gridRef,
|
|
325
|
-
outerGridElementRef: outerGridRef,
|
|
326
|
-
gridItemsRenderedRef: gridItemsRendered,
|
|
327
|
-
gridStyles: gridStyles,
|
|
328
|
-
columns: columns,
|
|
329
|
-
rowHeightsOptions: rowHeightsOptions
|
|
330
|
-
});
|
|
331
|
-
|
|
332
|
-
var _useDefaultRowHeight = (0, _row_heights.useDefaultRowHeight)({
|
|
333
|
-
rowHeightsOptions: rowHeightsOptions,
|
|
334
|
-
rowHeightUtils: rowHeightUtils
|
|
335
|
-
}),
|
|
336
|
-
defaultRowHeight = _useDefaultRowHeight.defaultRowHeight,
|
|
337
|
-
setRowHeight = _useDefaultRowHeight.setRowHeight,
|
|
338
|
-
getRowHeight = _useDefaultRowHeight.getRowHeight;
|
|
339
|
-
|
|
340
|
-
var unconstrainedHeight = (0, _grid_height_width.useUnconstrainedHeight)({
|
|
341
|
-
rowHeightUtils: rowHeightUtils,
|
|
342
|
-
startRow: startRow,
|
|
343
|
-
endRow: endRow,
|
|
344
|
-
rowHeightsOptions: rowHeightsOptions,
|
|
345
|
-
defaultRowHeight: defaultRowHeight,
|
|
346
|
-
headerRowHeight: headerRowHeight,
|
|
347
|
-
footerRowHeight: footerRowHeight,
|
|
348
|
-
scrollBarHeight: scrollBarHeight,
|
|
349
|
-
innerGridRef: innerGridRef
|
|
350
|
-
});
|
|
351
|
-
/**
|
|
352
|
-
* Final grid height & width
|
|
353
|
-
*/
|
|
354
|
-
|
|
355
|
-
var _useFinalGridDimensio = (0, _grid_height_width.useFinalGridDimensions)({
|
|
356
|
-
unconstrainedHeight: unconstrainedHeight,
|
|
357
|
-
unconstrainedWidth: 0,
|
|
358
|
-
// unable to determine this until the container's size is known
|
|
359
|
-
wrapperDimensions: wrapperDimensions,
|
|
360
|
-
wrapperRef: wrapperRef,
|
|
361
|
-
isFullScreen: isFullScreen,
|
|
362
|
-
rowCount: rowCount
|
|
363
|
-
}),
|
|
364
|
-
finalWidth = _useFinalGridDimensio.finalWidth,
|
|
365
|
-
finalHeight = _useFinalGridDimensio.finalHeight;
|
|
366
|
-
/**
|
|
367
|
-
* Grid resets
|
|
368
|
-
*/
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
(0, _react.useEffect)(function () {
|
|
372
|
-
if (gridRef.current) {
|
|
373
|
-
gridRef.current.resetAfterColumnIndex(0);
|
|
374
|
-
}
|
|
375
|
-
}, [gridRef, columns, columnWidths, defaultColumnWidth]);
|
|
376
|
-
(0, _react.useEffect)(function () {
|
|
377
|
-
if (gridRef.current && rowHeightsOptions) {
|
|
378
|
-
gridRef.current.resetAfterRowIndex(0);
|
|
379
|
-
}
|
|
380
|
-
}, [gridRef, pagination === null || pagination === void 0 ? void 0 : pagination.pageIndex, rowHeightsOptions, gridStyles === null || gridStyles === void 0 ? void 0 : gridStyles.cellPadding, gridStyles === null || gridStyles === void 0 ? void 0 : gridStyles.fontSize]);
|
|
381
|
-
(0, _react.useEffect)(function () {
|
|
382
|
-
if (gridRef.current) {
|
|
383
|
-
gridRef.current.resetAfterRowIndex(0);
|
|
384
|
-
}
|
|
385
|
-
}, [gridRef, getRowHeight]);
|
|
386
|
-
return _utils.IS_JEST_ENVIRONMENT || finalWidth > 0 ? (0, _react2.jsx)(DataGridWrapperRowsContext.Provider, {
|
|
387
|
-
value: {
|
|
388
|
-
headerRowHeight: headerRowHeight,
|
|
389
|
-
headerRow: headerRow,
|
|
390
|
-
footerRow: footerRow
|
|
391
|
-
}
|
|
392
|
-
}, (0, _react2.jsx)(_reactWindow.VariableSizeGrid, (0, _extends2.default)({}, virtualizationOptions ? virtualizationOptions : {}, {
|
|
393
|
-
ref: gridRef,
|
|
394
|
-
className: (0, _classnames.default)('euiDataGrid__virtualized', virtualizationOptions === null || virtualizationOptions === void 0 ? void 0 : virtualizationOptions.className),
|
|
395
|
-
onItemsRendered: function onItemsRendered(itemsRendered) {
|
|
396
|
-
var _virtualizationOption;
|
|
397
|
-
|
|
398
|
-
gridItemsRendered.current = itemsRendered;
|
|
399
|
-
virtualizationOptions === null || virtualizationOptions === void 0 ? void 0 : (_virtualizationOption = virtualizationOptions.onItemsRendered) === null || _virtualizationOption === void 0 ? void 0 : _virtualizationOption.call(virtualizationOptions, itemsRendered);
|
|
400
|
-
},
|
|
401
|
-
innerElementType: InnerElement,
|
|
402
|
-
outerRef: outerGridRef,
|
|
403
|
-
innerRef: innerGridRef,
|
|
404
|
-
columnCount: visibleColCount,
|
|
405
|
-
width: finalWidth,
|
|
406
|
-
columnWidth: getColumnWidth,
|
|
407
|
-
height: finalHeight,
|
|
408
|
-
rowHeight: getRowHeight,
|
|
409
|
-
itemData: {
|
|
410
|
-
schemaDetectors: schemaDetectors,
|
|
411
|
-
setRowHeight: setRowHeight,
|
|
412
|
-
leadingControlColumns: leadingControlColumns,
|
|
413
|
-
trailingControlColumns: trailingControlColumns,
|
|
414
|
-
columns: columns,
|
|
415
|
-
visibleColCount: visibleColCount,
|
|
416
|
-
schema: schema,
|
|
417
|
-
columnWidths: columnWidths,
|
|
418
|
-
defaultColumnWidth: defaultColumnWidth,
|
|
419
|
-
renderCellValue: renderCellValue,
|
|
420
|
-
renderCellPopover: renderCellPopover,
|
|
421
|
-
interactiveCellId: interactiveCellId,
|
|
422
|
-
rowHeightsOptions: rowHeightsOptions,
|
|
423
|
-
rowHeightUtils: rowHeightUtils,
|
|
424
|
-
rowManager: rowManager,
|
|
425
|
-
pagination: pagination
|
|
426
|
-
},
|
|
427
|
-
rowCount: _utils.IS_JEST_ENVIRONMENT || headerRowHeight > 0 ? visibleRowCount : 0
|
|
428
|
-
}), Cell), scrollBorderOverlay) : null;
|
|
33
|
+
return renderCustomGridBody ? (0, _react2.jsx)(_data_grid_body_custom.EuiDataGridBodyCustomRender, (0, _extends2.default)({
|
|
34
|
+
renderCustomGridBody: renderCustomGridBody
|
|
35
|
+
}, props)) : (0, _react2.jsx)(_data_grid_body_virtualized.EuiDataGridBodyVirtualized, props);
|
|
429
36
|
};
|
|
430
37
|
|
|
431
38
|
exports.EuiDataGridBody = EuiDataGridBody;
|