@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.
Files changed (259) hide show
  1. package/dist/eui_theme_dark.css +33 -6
  2. package/dist/eui_theme_dark.min.css +1 -1
  3. package/dist/eui_theme_light.css +33 -6
  4. package/dist/eui_theme_light.min.css +1 -1
  5. package/es/components/accessibility/skip_link/skip_link.js +15 -4
  6. package/es/components/avatar/avatar.js +1 -1
  7. package/es/components/badge/badge.js +1 -1
  8. package/es/components/badge/beta_badge/beta_badge.js +1 -1
  9. package/es/components/basic_table/basic_table.js +1 -1
  10. package/es/components/basic_table/collapsed_item_actions.js +1 -1
  11. package/es/components/basic_table/in_memory_table.js +1 -1
  12. package/es/components/button/_button_content_deprecated.js +1 -1
  13. package/es/components/button/button_display/_button_display.js +1 -1
  14. package/es/components/button/button_display/_button_display_content.js +1 -1
  15. package/es/components/button/button_empty/button_empty.js +1 -1
  16. package/es/components/button/button_group/button_group.js +1 -1
  17. package/es/components/button/button_group/button_group_button.js +1 -1
  18. package/es/components/button/button_icon/button_icon.js +1 -1
  19. package/es/components/call_out/call_out.js +1 -1
  20. package/es/components/card/card.js +1 -1
  21. package/es/components/code/code_block_full_screen.js +2 -0
  22. package/es/components/collapsible_nav/collapsible_nav_group/collapsible_nav_group.js +1 -1
  23. package/es/components/comment_list/comment.js +2 -2
  24. package/es/components/comment_list/comment_event.js +1 -1
  25. package/es/components/comment_list/comment_list.js +2 -2
  26. package/es/components/comment_list/comment_timeline.js +1 -1
  27. package/es/components/datagrid/body/data_grid_body.js +32 -408
  28. package/es/components/datagrid/body/data_grid_body_custom.js +908 -0
  29. package/es/components/datagrid/body/data_grid_body_virtualized.js +1031 -0
  30. package/es/components/datagrid/body/data_grid_cell.js +34 -33
  31. package/es/components/datagrid/body/data_grid_cell_wrapper.js +132 -0
  32. package/es/components/datagrid/body/header/data_grid_header_cell.js +12 -12
  33. package/es/components/datagrid/body/header/data_grid_header_row.js +16 -15
  34. package/es/components/datagrid/controls/column_sorting_draggable.js +1 -1
  35. package/es/components/datagrid/data_grid.js +34 -18
  36. package/es/components/datagrid/data_grid_types.js +18 -1
  37. package/es/components/datagrid/utils/in_memory.js +12 -12
  38. package/es/components/datagrid/utils/row_heights.js +111 -31
  39. package/es/components/date_picker/date_picker.js +2 -2
  40. package/es/components/date_picker/date_picker_range.js +1 -1
  41. package/es/components/empty_prompt/empty_prompt.js +1 -1
  42. package/es/components/facet/facet_button.js +1 -1
  43. package/es/components/flyout/flyout.js +1 -0
  44. package/es/components/form/field_number/field_number.js +1 -1
  45. package/es/components/form/field_text/field_text.js +2 -2
  46. package/es/components/form/form_control_layout/form_control_layout.js +2 -2
  47. package/es/components/form/form_control_layout/form_control_layout_custom_icon.js +1 -1
  48. package/es/components/form/form_control_layout/form_control_layout_icons.js +2 -2
  49. package/es/components/header/header_links/header_link.js +1 -1
  50. package/es/components/header/header_links/header_links.js +1 -1
  51. package/es/components/header/header_logo.js +1 -1
  52. package/es/components/icon/icon.js +1 -1
  53. package/es/components/icon/icon_map.js +2 -0
  54. package/es/components/image/image_fullscreen_wrapper.js +2 -0
  55. package/es/components/key_pad_menu/key_pad_menu_item.js +1 -1
  56. package/es/components/list_group/list_group.js +2 -2
  57. package/es/components/list_group/list_group_item.js +2 -2
  58. package/es/components/list_group/list_group_item_extra_action.js +1 -1
  59. package/es/components/list_group/pinnable_list_group/pinnable_list_group.js +4 -4
  60. package/es/components/loading/loading_logo.js +1 -1
  61. package/es/components/markdown_editor/markdown_editor.js +1 -1
  62. package/es/components/markdown_editor/markdown_editor_drop_zone.js +1 -1
  63. package/es/components/markdown_editor/markdown_editor_footer.js +1 -1
  64. package/es/components/markdown_editor/markdown_editor_toolbar.js +1 -1
  65. package/es/components/notification/notification_event.js +2 -2
  66. package/es/components/notification/notification_event_meta.js +1 -1
  67. package/es/components/page/page_header/page_header_content.js +1 -1
  68. package/es/components/pagination/pagination_button.js +1 -1
  69. package/es/components/selectable/selectable_list/selectable_list.js +1 -1
  70. package/es/components/selectable/selectable_list/selectable_list_item.js +1 -1
  71. package/es/components/selectable/selectable_templates/selectable_template_sitewide.js +1 -1
  72. package/es/components/suggest/suggest.js +1 -1
  73. package/es/components/suggest/suggest_item.js +1 -1
  74. package/es/components/table/table_header_button.js +1 -1
  75. package/es/components/timeline/timeline_item_icon.js +1 -1
  76. package/es/components/toast/global_toast_list.js +1 -1
  77. package/es/components/toast/toast.js +1 -1
  78. package/es/components/tool_tip/icon_tip.js +1 -1
  79. package/eui.d.ts +236 -139
  80. package/i18ntokens.json +8 -8
  81. package/lib/components/accessibility/skip_link/skip_link.js +15 -4
  82. package/lib/components/avatar/avatar.js +1 -1
  83. package/lib/components/badge/badge.js +1 -1
  84. package/lib/components/badge/beta_badge/beta_badge.js +1 -1
  85. package/lib/components/basic_table/basic_table.js +1 -1
  86. package/lib/components/basic_table/collapsed_item_actions.js +1 -1
  87. package/lib/components/basic_table/in_memory_table.js +1 -1
  88. package/lib/components/button/_button_content_deprecated.js +1 -1
  89. package/lib/components/button/button_display/_button_display.js +1 -1
  90. package/lib/components/button/button_display/_button_display_content.js +1 -1
  91. package/lib/components/button/button_empty/button_empty.js +1 -1
  92. package/lib/components/button/button_group/button_group.js +1 -1
  93. package/lib/components/button/button_group/button_group_button.js +1 -1
  94. package/lib/components/button/button_icon/button_icon.js +1 -1
  95. package/lib/components/call_out/call_out.js +1 -1
  96. package/lib/components/card/card.js +1 -1
  97. package/lib/components/code/code_block_full_screen.js +2 -0
  98. package/lib/components/collapsible_nav/collapsible_nav_group/collapsible_nav_group.js +1 -1
  99. package/lib/components/comment_list/comment.js +2 -2
  100. package/lib/components/comment_list/comment_event.js +1 -1
  101. package/lib/components/comment_list/comment_list.js +2 -2
  102. package/lib/components/comment_list/comment_timeline.js +1 -1
  103. package/lib/components/datagrid/body/data_grid_body.js +32 -429
  104. package/lib/components/datagrid/body/data_grid_body_custom.js +927 -0
  105. package/lib/components/datagrid/body/data_grid_body_virtualized.js +1059 -0
  106. package/lib/components/datagrid/body/data_grid_cell.js +34 -33
  107. package/lib/components/datagrid/body/data_grid_cell_wrapper.js +147 -0
  108. package/lib/components/datagrid/body/header/data_grid_header_cell.js +12 -12
  109. package/lib/components/datagrid/body/header/data_grid_header_row.js +17 -15
  110. package/lib/components/datagrid/controls/column_sorting_draggable.js +1 -1
  111. package/lib/components/datagrid/data_grid.js +34 -17
  112. package/lib/components/datagrid/data_grid_types.js +22 -1
  113. package/lib/components/datagrid/utils/in_memory.js +12 -12
  114. package/lib/components/datagrid/utils/row_heights.js +116 -33
  115. package/lib/components/date_picker/date_picker.js +2 -2
  116. package/lib/components/date_picker/date_picker_range.js +1 -1
  117. package/lib/components/empty_prompt/empty_prompt.js +1 -1
  118. package/lib/components/facet/facet_button.js +1 -1
  119. package/lib/components/flyout/flyout.js +1 -0
  120. package/lib/components/form/field_number/field_number.js +1 -1
  121. package/lib/components/form/field_text/field_text.js +2 -2
  122. package/lib/components/form/form_control_layout/form_control_layout.js +2 -2
  123. package/lib/components/form/form_control_layout/form_control_layout_custom_icon.js +1 -1
  124. package/lib/components/form/form_control_layout/form_control_layout_icons.js +2 -2
  125. package/lib/components/header/header_links/header_link.js +1 -1
  126. package/lib/components/header/header_links/header_links.js +1 -1
  127. package/lib/components/header/header_logo.js +1 -1
  128. package/lib/components/icon/icon.js +1 -1
  129. package/lib/components/icon/icon_map.js +2 -0
  130. package/lib/components/image/image_fullscreen_wrapper.js +2 -0
  131. package/lib/components/key_pad_menu/key_pad_menu_item.js +1 -1
  132. package/lib/components/list_group/list_group.js +2 -2
  133. package/lib/components/list_group/list_group_item.js +2 -2
  134. package/lib/components/list_group/list_group_item_extra_action.js +1 -1
  135. package/lib/components/list_group/pinnable_list_group/pinnable_list_group.js +4 -4
  136. package/lib/components/loading/loading_logo.js +1 -1
  137. package/lib/components/markdown_editor/markdown_editor.js +1 -1
  138. package/lib/components/markdown_editor/markdown_editor_drop_zone.js +1 -1
  139. package/lib/components/markdown_editor/markdown_editor_footer.js +1 -1
  140. package/lib/components/markdown_editor/markdown_editor_toolbar.js +1 -1
  141. package/lib/components/notification/notification_event.js +2 -2
  142. package/lib/components/notification/notification_event_meta.js +1 -1
  143. package/lib/components/page/page_header/page_header_content.js +1 -1
  144. package/lib/components/selectable/selectable_list/selectable_list.js +1 -1
  145. package/lib/components/selectable/selectable_list/selectable_list_item.js +1 -1
  146. package/lib/components/selectable/selectable_templates/selectable_template_sitewide.js +1 -1
  147. package/lib/components/suggest/suggest.js +1 -1
  148. package/lib/components/suggest/suggest_item.js +1 -1
  149. package/lib/components/table/table_header_button.js +1 -1
  150. package/lib/components/timeline/timeline_item_icon.js +1 -1
  151. package/lib/components/toast/global_toast_list.js +1 -1
  152. package/lib/components/toast/toast.js +1 -1
  153. package/lib/components/tool_tip/icon_tip.js +1 -1
  154. package/optimize/es/components/accessibility/skip_link/skip_link.js +8 -1
  155. package/optimize/es/components/code/code_block_full_screen.js +2 -0
  156. package/optimize/es/components/datagrid/body/data_grid_body.js +17 -387
  157. package/optimize/es/components/datagrid/body/data_grid_body_custom.js +176 -0
  158. package/optimize/es/components/datagrid/body/data_grid_body_virtualized.js +311 -0
  159. package/optimize/es/components/datagrid/body/data_grid_cell.js +8 -7
  160. package/optimize/es/components/datagrid/body/data_grid_cell_wrapper.js +127 -0
  161. package/optimize/es/components/datagrid/body/header/data_grid_header_row.js +3 -2
  162. package/optimize/es/components/datagrid/data_grid.js +8 -5
  163. package/optimize/es/components/datagrid/data_grid_types.js +18 -1
  164. package/optimize/es/components/datagrid/utils/row_heights.js +100 -31
  165. package/optimize/es/components/flyout/flyout.js +1 -0
  166. package/optimize/es/components/icon/icon_map.js +2 -0
  167. package/optimize/es/components/image/image_fullscreen_wrapper.js +2 -0
  168. package/optimize/lib/components/accessibility/skip_link/skip_link.js +8 -1
  169. package/optimize/lib/components/code/code_block_full_screen.js +2 -0
  170. package/optimize/lib/components/datagrid/body/data_grid_body.js +16 -409
  171. package/optimize/lib/components/datagrid/body/data_grid_body_custom.js +198 -0
  172. package/optimize/lib/components/datagrid/body/data_grid_body_virtualized.js +342 -0
  173. package/optimize/lib/components/datagrid/body/data_grid_cell.js +8 -7
  174. package/optimize/lib/components/datagrid/body/data_grid_cell_wrapper.js +144 -0
  175. package/optimize/lib/components/datagrid/body/header/data_grid_header_row.js +4 -2
  176. package/optimize/lib/components/datagrid/data_grid.js +8 -4
  177. package/optimize/lib/components/datagrid/data_grid_types.js +22 -1
  178. package/optimize/lib/components/datagrid/utils/row_heights.js +103 -37
  179. package/optimize/lib/components/flyout/flyout.js +1 -0
  180. package/optimize/lib/components/icon/icon_map.js +2 -0
  181. package/optimize/lib/components/image/image_fullscreen_wrapper.js +2 -0
  182. package/package.json +1 -1
  183. package/src/components/datagrid/_data_grid.scss +7 -0
  184. package/src/components/datagrid/_data_grid_data_row.scss +1 -0
  185. package/src/components/datagrid/body/footer/_data_grid_footer_row.scss +1 -0
  186. package/src/components/datagrid/body/header/_data_grid_header_row.scss +1 -0
  187. package/src/components/selectable/selectable_list/_selectable_list.scss +10 -3
  188. package/src/themes/amsterdam/global_styling/mixins/_states.scss +17 -8
  189. package/test-env/components/accessibility/skip_link/skip_link.js +15 -4
  190. package/test-env/components/avatar/avatar.js +1 -1
  191. package/test-env/components/badge/badge.js +1 -1
  192. package/test-env/components/badge/beta_badge/beta_badge.js +1 -1
  193. package/test-env/components/basic_table/basic_table.js +1 -1
  194. package/test-env/components/basic_table/collapsed_item_actions.js +1 -1
  195. package/test-env/components/basic_table/in_memory_table.js +1 -1
  196. package/test-env/components/button/_button_content_deprecated.js +1 -1
  197. package/test-env/components/button/button_display/_button_display.js +1 -1
  198. package/test-env/components/button/button_display/_button_display_content.js +1 -1
  199. package/test-env/components/button/button_empty/button_empty.js +1 -1
  200. package/test-env/components/button/button_group/button_group.js +1 -1
  201. package/test-env/components/button/button_group/button_group_button.js +1 -1
  202. package/test-env/components/button/button_icon/button_icon.js +1 -1
  203. package/test-env/components/call_out/call_out.js +1 -1
  204. package/test-env/components/card/card.js +1 -1
  205. package/test-env/components/code/code_block_full_screen.js +2 -0
  206. package/test-env/components/collapsible_nav/collapsible_nav_group/collapsible_nav_group.js +1 -1
  207. package/test-env/components/comment_list/comment.js +2 -2
  208. package/test-env/components/comment_list/comment_event.js +1 -1
  209. package/test-env/components/comment_list/comment_list.js +2 -2
  210. package/test-env/components/comment_list/comment_timeline.js +1 -1
  211. package/test-env/components/datagrid/body/data_grid_body.js +31 -428
  212. package/test-env/components/datagrid/body/data_grid_body_custom.js +908 -0
  213. package/test-env/components/datagrid/body/data_grid_body_virtualized.js +1057 -0
  214. package/test-env/components/datagrid/body/data_grid_cell.js +34 -33
  215. package/test-env/components/datagrid/body/data_grid_cell_wrapper.js +144 -0
  216. package/test-env/components/datagrid/body/header/data_grid_header_cell.js +12 -12
  217. package/test-env/components/datagrid/body/header/data_grid_header_row.js +17 -15
  218. package/test-env/components/datagrid/controls/column_sorting_draggable.js +1 -1
  219. package/test-env/components/datagrid/data_grid.js +34 -17
  220. package/test-env/components/datagrid/data_grid_types.js +22 -1
  221. package/test-env/components/datagrid/utils/in_memory.js +12 -12
  222. package/test-env/components/datagrid/utils/row_heights.js +103 -37
  223. package/test-env/components/date_picker/date_picker.js +2 -2
  224. package/test-env/components/date_picker/date_picker_range.js +1 -1
  225. package/test-env/components/empty_prompt/empty_prompt.js +1 -1
  226. package/test-env/components/facet/facet_button.js +1 -1
  227. package/test-env/components/form/field_number/field_number.js +1 -1
  228. package/test-env/components/form/field_text/field_text.js +2 -2
  229. package/test-env/components/form/form_control_layout/form_control_layout.js +2 -2
  230. package/test-env/components/form/form_control_layout/form_control_layout_custom_icon.js +1 -1
  231. package/test-env/components/form/form_control_layout/form_control_layout_icons.js +2 -2
  232. package/test-env/components/header/header_links/header_link.js +1 -1
  233. package/test-env/components/header/header_links/header_links.js +1 -1
  234. package/test-env/components/header/header_logo.js +1 -1
  235. package/test-env/components/icon/icon_map.js +2 -0
  236. package/test-env/components/image/image_fullscreen_wrapper.js +2 -0
  237. package/test-env/components/key_pad_menu/key_pad_menu_item.js +1 -1
  238. package/test-env/components/list_group/list_group.js +2 -2
  239. package/test-env/components/list_group/list_group_item.js +2 -2
  240. package/test-env/components/list_group/list_group_item_extra_action.js +1 -1
  241. package/test-env/components/list_group/pinnable_list_group/pinnable_list_group.js +4 -4
  242. package/test-env/components/loading/loading_logo.js +1 -1
  243. package/test-env/components/markdown_editor/markdown_editor.js +1 -1
  244. package/test-env/components/markdown_editor/markdown_editor_drop_zone.js +1 -1
  245. package/test-env/components/markdown_editor/markdown_editor_footer.js +1 -1
  246. package/test-env/components/markdown_editor/markdown_editor_toolbar.js +1 -1
  247. package/test-env/components/notification/notification_event.js +2 -2
  248. package/test-env/components/notification/notification_event_meta.js +1 -1
  249. package/test-env/components/page/page_header/page_header_content.js +1 -1
  250. package/test-env/components/selectable/selectable_list/selectable_list.js +1 -1
  251. package/test-env/components/selectable/selectable_list/selectable_list_item.js +1 -1
  252. package/test-env/components/selectable/selectable_templates/selectable_template_sitewide.js +1 -1
  253. package/test-env/components/suggest/suggest.js +1 -1
  254. package/test-env/components/suggest/suggest_item.js +1 -1
  255. package/test-env/components/table/table_header_button.js +1 -1
  256. package/test-env/components/timeline/timeline_item_icon.js +1 -1
  257. package/test-env/components/toast/global_toast_list.js +1 -1
  258. package/test-env/components/toast/toast.js +1 -1
  259. package/test-env/components/tool_tip/icon_tip.js +1 -1
@@ -1,11 +1,6 @@
1
- import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
2
1
  import _extends from "@babel/runtime/helpers/extends";
3
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
4
- var _excluded = ["children", "style"];
5
-
6
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
7
-
8
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
2
+ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
+ var _excluded = ["renderCustomGridBody"];
9
4
 
10
5
  /*
11
6
  * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
@@ -14,385 +9,20 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
14
9
  * in compliance with, at your election, the Elastic License 2.0 or the Server
15
10
  * Side Public License, v 1.
16
11
  */
17
- import classNames from 'classnames';
18
- import React, { forwardRef, createContext, useContext, useEffect, useRef } from 'react';
19
- import { VariableSizeGrid as Grid } from 'react-window';
20
- import { useResizeObserver } from '../../observer/resize_observer';
21
- import { EuiDataGridCell } from './data_grid_cell';
22
- import { useDataGridHeader } from './header';
23
- import { useDataGridFooter } from './footer';
24
- import { DataGridCellPopoverContext } from './data_grid_cell_popover';
25
- import { useRowManager } from './data_grid_row_manager';
26
- import { useFinalGridDimensions, useUnconstrainedHeight, useVirtualizeContainerWidth } from '../utils/grid_height_width';
27
- import { useDefaultColumnWidth, useColumnWidths } from '../utils/col_widths';
28
- import { useRowHeightUtils, useDefaultRowHeight } from '../utils/row_heights';
29
- import { useScrollBars, useScroll } from '../utils/scrolling';
30
- import { DataGridSortingContext } from '../utils/sorting';
31
- import { IS_JEST_ENVIRONMENT } from '../../../utils';
12
+ import React from 'react';
13
+ import { EuiDataGridBodyVirtualized } from './data_grid_body_virtualized';
14
+ import { EuiDataGridBodyCustomRender } from './data_grid_body_custom';
32
15
  import { jsx as ___EmotionJSX } from "@emotion/react";
33
- export var Cell = function Cell(_ref) {
34
- var columnIndex = _ref.columnIndex,
35
- visibleRowIndex = _ref.rowIndex,
36
- style = _ref.style,
37
- data = _ref.data;
38
- var leadingControlColumns = data.leadingControlColumns,
39
- trailingControlColumns = data.trailingControlColumns,
40
- columns = data.columns,
41
- visibleColCount = data.visibleColCount,
42
- schema = data.schema,
43
- columnWidths = data.columnWidths,
44
- defaultColumnWidth = data.defaultColumnWidth,
45
- renderCellValue = data.renderCellValue,
46
- renderCellPopover = data.renderCellPopover,
47
- interactiveCellId = data.interactiveCellId,
48
- setRowHeight = data.setRowHeight,
49
- schemaDetectors = data.schemaDetectors,
50
- rowHeightsOptions = data.rowHeightsOptions,
51
- rowHeightUtils = data.rowHeightUtils,
52
- rowManager = data.rowManager,
53
- pagination = data.pagination;
54
- var popoverContext = useContext(DataGridCellPopoverContext);
55
-
56
- var _useContext = useContext(DataGridWrapperRowsContext),
57
- headerRowHeight = _useContext.headerRowHeight;
58
-
59
- var _useContext2 = useContext(DataGridSortingContext),
60
- getCorrectRowIndex = _useContext2.getCorrectRowIndex;
61
-
62
- var cellContent;
63
- var isFirstColumn = columnIndex === 0;
64
- var isLastColumn = columnIndex === visibleColCount - 1;
65
- var isLeadingControlColumn = columnIndex < leadingControlColumns.length;
66
- var isTrailingControlColumn = columnIndex >= leadingControlColumns.length + columns.length;
67
- var dataColumnIndex = columnIndex - leadingControlColumns.length;
68
- var column = columns[dataColumnIndex];
69
- var columnId = column === null || column === void 0 ? void 0 : column.id;
70
- var transformClass = schemaDetectors.filter(function (row) {
71
- return column !== null && column !== void 0 && column.schema ? (column === null || column === void 0 ? void 0 : column.schema) === row.type : columnId === row.type;
72
- })[0];
73
- var textTransform = transformClass === null || transformClass === void 0 ? void 0 : transformClass.textTransform;
74
- var classes = classNames(_defineProperty({
75
- 'euiDataGridRowCell--firstColumn': isFirstColumn,
76
- 'euiDataGridRowCell--lastColumn': isLastColumn,
77
- 'euiDataGridRowCell--controlColumn': isLeadingControlColumn || isTrailingControlColumn
78
- }, "euiDataGridRowCell--".concat(textTransform), textTransform));
79
- var sharedCellProps = {
80
- rowIndex: getCorrectRowIndex(visibleRowIndex),
81
- visibleRowIndex: visibleRowIndex,
82
- colIndex: columnIndex,
83
- interactiveCellId: interactiveCellId,
84
- className: classes,
85
- style: _objectSpread(_objectSpread({}, style), {}, {
86
- top: "".concat(parseFloat(style.top) + headerRowHeight, "px")
87
- }),
88
- rowHeightsOptions: rowHeightsOptions,
89
- rowHeightUtils: rowHeightUtils,
90
- setRowHeight: isFirstColumn ? setRowHeight : undefined,
91
- rowManager: rowManager,
92
- popoverContext: popoverContext,
93
- pagination: pagination
94
- };
95
-
96
- if (isLeadingControlColumn) {
97
- var leadingColumn = leadingControlColumns[columnIndex];
98
- var id = leadingColumn.id,
99
- rowCellRender = leadingColumn.rowCellRender;
100
- cellContent = ___EmotionJSX(EuiDataGridCell, _extends({}, sharedCellProps, {
101
- columnId: id,
102
- width: leadingColumn.width,
103
- renderCellValue: rowCellRender,
104
- isExpandable: false
105
- }));
106
- } else if (isTrailingControlColumn) {
107
- var columnOffset = columns.length + leadingControlColumns.length;
108
- var trailingColumnIndex = columnIndex - columnOffset;
109
- var trailingColumn = trailingControlColumns[trailingColumnIndex];
110
- var _id = trailingColumn.id,
111
- _rowCellRender = trailingColumn.rowCellRender;
112
- cellContent = ___EmotionJSX(EuiDataGridCell, _extends({}, sharedCellProps, {
113
- columnId: _id,
114
- width: trailingColumn.width,
115
- renderCellValue: _rowCellRender,
116
- isExpandable: false
117
- }));
118
- } else {
119
- // this is a normal data cell
120
- var columnType = schema[columnId] ? schema[columnId].columnType : null;
121
- var isExpandable = column.isExpandable !== undefined ? column.isExpandable : true;
122
- var width = columnWidths[columnId] || defaultColumnWidth;
123
- cellContent = ___EmotionJSX(EuiDataGridCell, _extends({}, sharedCellProps, {
124
- columnId: columnId,
125
- column: column,
126
- columnType: columnType,
127
- width: width || undefined,
128
- renderCellValue: renderCellValue,
129
- renderCellPopover: renderCellPopover,
130
- interactiveCellId: interactiveCellId,
131
- isExpandable: isExpandable
132
- }));
133
- }
134
-
135
- return cellContent;
136
- }; // Context is required to pass props to react-window's innerElementType
137
- // @see https://github.com/bvaughn/react-window/issues/404
138
-
139
- export var DataGridWrapperRowsContext = /*#__PURE__*/createContext({
140
- headerRow: ___EmotionJSX("div", null),
141
- headerRowHeight: 0,
142
- footerRow: null
143
- });
144
- var InnerElement = /*#__PURE__*/forwardRef(function (_ref2, ref) {
145
- var children = _ref2.children,
146
- style = _ref2.style,
147
- rest = _objectWithoutProperties(_ref2, _excluded);
148
-
149
- var _useContext3 = useContext(DataGridWrapperRowsContext),
150
- headerRowHeight = _useContext3.headerRowHeight,
151
- headerRow = _useContext3.headerRow,
152
- footerRow = _useContext3.footerRow;
153
-
154
- return ___EmotionJSX(React.Fragment, null, ___EmotionJSX("div", _extends({
155
- ref: ref,
156
- style: _objectSpread(_objectSpread({}, style), {}, {
157
- height: style.height + headerRowHeight
158
- })
159
- }, rest), headerRow, children), footerRow);
160
- });
161
- InnerElement.displayName = 'EuiDataGridInnerElement';
162
- export var EuiDataGridBody = function EuiDataGridBody(props) {
163
- var leadingControlColumns = props.leadingControlColumns,
164
- trailingControlColumns = props.trailingControlColumns,
165
- columns = props.columns,
166
- visibleColCount = props.visibleColCount,
167
- schema = props.schema,
168
- schemaDetectors = props.schemaDetectors,
169
- rowCount = props.rowCount,
170
- _props$visibleRows = props.visibleRows,
171
- startRow = _props$visibleRows.startRow,
172
- endRow = _props$visibleRows.endRow,
173
- visibleRowCount = _props$visibleRows.visibleRowCount,
174
- renderCellValue = props.renderCellValue,
175
- renderCellPopover = props.renderCellPopover,
176
- renderFooterCellValue = props.renderFooterCellValue,
177
- interactiveCellId = props.interactiveCellId,
178
- pagination = props.pagination,
179
- headerIsInteractive = props.headerIsInteractive,
180
- handleHeaderMutation = props.handleHeaderMutation,
181
- setVisibleColumns = props.setVisibleColumns,
182
- switchColumnPos = props.switchColumnPos,
183
- onColumnResize = props.onColumnResize,
184
- rowHeightsOptions = props.rowHeightsOptions,
185
- virtualizationOptions = props.virtualizationOptions,
186
- isFullScreen = props.isFullScreen,
187
- gridStyles = props.gridStyles,
188
- gridWidth = props.gridWidth,
189
- gridRef = props.gridRef,
190
- gridItemsRendered = props.gridItemsRendered,
191
- wrapperRef = props.wrapperRef;
192
- /**
193
- * Grid refs & observers
194
- */
195
-
196
- var wrapperDimensions = useResizeObserver(wrapperRef.current);
197
- var outerGridRef = useRef(null); // container that becomes scrollable
198
-
199
- var innerGridRef = useRef(null); // container sized to fit all content
200
-
201
- /**
202
- * Scroll bars
203
- */
204
-
205
- var _useScrollBars = useScrollBars(outerGridRef, gridStyles.border),
206
- scrollBarHeight = _useScrollBars.scrollBarHeight,
207
- hasVerticalScroll = _useScrollBars.hasVerticalScroll,
208
- hasHorizontalScroll = _useScrollBars.hasHorizontalScroll,
209
- scrollBorderOverlay = _useScrollBars.scrollBorderOverlay;
210
- /**
211
- * Widths
212
- */
213
-
214
-
215
- var virtualizeContainerWidth = useVirtualizeContainerWidth(outerGridRef.current, gridWidth, pagination === null || pagination === void 0 ? void 0 : pagination.pageSize); // compute the default column width from the container's width and count of visible columns
216
-
217
- var defaultColumnWidth = useDefaultColumnWidth(virtualizeContainerWidth, leadingControlColumns, trailingControlColumns, columns);
218
-
219
- var _useColumnWidths = useColumnWidths({
220
- columns: columns,
221
- leadingControlColumns: leadingControlColumns,
222
- trailingControlColumns: trailingControlColumns,
223
- defaultColumnWidth: defaultColumnWidth,
224
- onColumnResize: onColumnResize
225
- }),
226
- columnWidths = _useColumnWidths.columnWidths,
227
- setColumnWidth = _useColumnWidths.setColumnWidth,
228
- getColumnWidth = _useColumnWidths.getColumnWidth;
229
- /**
230
- * Header & footer
231
- */
232
-
233
-
234
- var _useDataGridHeader = useDataGridHeader({
235
- headerIsInteractive: headerIsInteractive,
236
- handleHeaderMutation: handleHeaderMutation,
237
- switchColumnPos: switchColumnPos,
238
- setVisibleColumns: setVisibleColumns,
239
- leadingControlColumns: leadingControlColumns,
240
- trailingControlColumns: trailingControlColumns,
241
- columns: columns,
242
- columnWidths: columnWidths,
243
- defaultColumnWidth: defaultColumnWidth,
244
- setColumnWidth: setColumnWidth,
245
- schema: schema,
246
- schemaDetectors: schemaDetectors
247
- }),
248
- headerRow = _useDataGridHeader.headerRow,
249
- headerRowHeight = _useDataGridHeader.headerRowHeight;
250
-
251
- var _useDataGridFooter = useDataGridFooter({
252
- renderFooterCellValue: renderFooterCellValue,
253
- renderCellPopover: renderCellPopover,
254
- rowIndex: visibleRowCount,
255
- visibleRowIndex: visibleRowCount,
256
- interactiveCellId: interactiveCellId,
257
- leadingControlColumns: leadingControlColumns,
258
- trailingControlColumns: trailingControlColumns,
259
- columns: columns,
260
- columnWidths: columnWidths,
261
- defaultColumnWidth: defaultColumnWidth,
262
- schema: schema
263
- }),
264
- footerRow = _useDataGridFooter.footerRow,
265
- footerRowHeight = _useDataGridFooter.footerRowHeight;
266
- /**
267
- * Handle scrolling cells fully into view
268
- */
269
-
270
-
271
- useScroll({
272
- gridRef: gridRef,
273
- outerGridRef: outerGridRef,
274
- hasGridScrolling: hasVerticalScroll || hasHorizontalScroll,
275
- headerRowHeight: headerRowHeight,
276
- footerRowHeight: footerRowHeight,
277
- visibleRowCount: visibleRowCount,
278
- hasStickyFooter: !!(renderFooterCellValue && gridStyles.stickyFooter)
279
- });
280
- /**
281
- * Row manager
282
- */
283
-
284
- var rowManager = useRowManager({
285
- innerGridRef: innerGridRef,
286
- rowClasses: gridStyles.rowClasses
287
- });
288
- /**
289
- * Heights
290
- */
291
-
292
- var rowHeightUtils = useRowHeightUtils({
293
- gridRef: gridRef,
294
- outerGridElementRef: outerGridRef,
295
- gridItemsRenderedRef: gridItemsRendered,
296
- gridStyles: gridStyles,
297
- columns: columns,
298
- rowHeightsOptions: rowHeightsOptions
299
- });
300
-
301
- var _useDefaultRowHeight = useDefaultRowHeight({
302
- rowHeightsOptions: rowHeightsOptions,
303
- rowHeightUtils: rowHeightUtils
304
- }),
305
- defaultRowHeight = _useDefaultRowHeight.defaultRowHeight,
306
- setRowHeight = _useDefaultRowHeight.setRowHeight,
307
- getRowHeight = _useDefaultRowHeight.getRowHeight;
308
-
309
- var unconstrainedHeight = useUnconstrainedHeight({
310
- rowHeightUtils: rowHeightUtils,
311
- startRow: startRow,
312
- endRow: endRow,
313
- rowHeightsOptions: rowHeightsOptions,
314
- defaultRowHeight: defaultRowHeight,
315
- headerRowHeight: headerRowHeight,
316
- footerRowHeight: footerRowHeight,
317
- scrollBarHeight: scrollBarHeight,
318
- innerGridRef: innerGridRef
319
- });
320
- /**
321
- * Final grid height & width
322
- */
323
-
324
- var _useFinalGridDimensio = useFinalGridDimensions({
325
- unconstrainedHeight: unconstrainedHeight,
326
- unconstrainedWidth: 0,
327
- // unable to determine this until the container's size is known
328
- wrapperDimensions: wrapperDimensions,
329
- wrapperRef: wrapperRef,
330
- isFullScreen: isFullScreen,
331
- rowCount: rowCount
332
- }),
333
- finalWidth = _useFinalGridDimensio.finalWidth,
334
- finalHeight = _useFinalGridDimensio.finalHeight;
335
- /**
336
- * Grid resets
337
- */
338
-
339
-
340
- useEffect(function () {
341
- if (gridRef.current) {
342
- gridRef.current.resetAfterColumnIndex(0);
343
- }
344
- }, [gridRef, columns, columnWidths, defaultColumnWidth]);
345
- useEffect(function () {
346
- if (gridRef.current && rowHeightsOptions) {
347
- gridRef.current.resetAfterRowIndex(0);
348
- }
349
- }, [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]);
350
- useEffect(function () {
351
- if (gridRef.current) {
352
- gridRef.current.resetAfterRowIndex(0);
353
- }
354
- }, [gridRef, getRowHeight]);
355
- return IS_JEST_ENVIRONMENT || finalWidth > 0 ? ___EmotionJSX(DataGridWrapperRowsContext.Provider, {
356
- value: {
357
- headerRowHeight: headerRowHeight,
358
- headerRow: headerRow,
359
- footerRow: footerRow
360
- }
361
- }, ___EmotionJSX(Grid, _extends({}, virtualizationOptions ? virtualizationOptions : {}, {
362
- ref: gridRef,
363
- className: classNames('euiDataGrid__virtualized', virtualizationOptions === null || virtualizationOptions === void 0 ? void 0 : virtualizationOptions.className),
364
- onItemsRendered: function onItemsRendered(itemsRendered) {
365
- var _virtualizationOption;
366
-
367
- gridItemsRendered.current = itemsRendered;
368
- virtualizationOptions === null || virtualizationOptions === void 0 ? void 0 : (_virtualizationOption = virtualizationOptions.onItemsRendered) === null || _virtualizationOption === void 0 ? void 0 : _virtualizationOption.call(virtualizationOptions, itemsRendered);
369
- },
370
- innerElementType: InnerElement,
371
- outerRef: outerGridRef,
372
- innerRef: innerGridRef,
373
- columnCount: visibleColCount,
374
- width: finalWidth,
375
- columnWidth: getColumnWidth,
376
- height: finalHeight,
377
- rowHeight: getRowHeight,
378
- itemData: {
379
- schemaDetectors: schemaDetectors,
380
- setRowHeight: setRowHeight,
381
- leadingControlColumns: leadingControlColumns,
382
- trailingControlColumns: trailingControlColumns,
383
- columns: columns,
384
- visibleColCount: visibleColCount,
385
- schema: schema,
386
- columnWidths: columnWidths,
387
- defaultColumnWidth: defaultColumnWidth,
388
- renderCellValue: renderCellValue,
389
- renderCellPopover: renderCellPopover,
390
- interactiveCellId: interactiveCellId,
391
- rowHeightsOptions: rowHeightsOptions,
392
- rowHeightUtils: rowHeightUtils,
393
- rowManager: rowManager,
394
- pagination: pagination
395
- },
396
- rowCount: IS_JEST_ENVIRONMENT || headerRowHeight > 0 ? visibleRowCount : 0
397
- }), Cell), scrollBorderOverlay) : null;
16
+ export var EuiDataGridBody = function EuiDataGridBody(_ref) {
17
+ var renderCustomGridBody = _ref.renderCustomGridBody,
18
+ props = _objectWithoutProperties(_ref, _excluded);
19
+
20
+ /*
21
+ * Determine whether we should use the default EuiDataGridBody
22
+ * + virtualization library for rendering content, or if consumers have
23
+ * passed their own custom renderer
24
+ */
25
+ return renderCustomGridBody ? ___EmotionJSX(EuiDataGridBodyCustomRender, _extends({
26
+ renderCustomGridBody: renderCustomGridBody
27
+ }, props)) : ___EmotionJSX(EuiDataGridBodyVirtualized, props);
398
28
  };
@@ -0,0 +1,176 @@
1
+ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
+ import _extends from "@babel/runtime/helpers/extends";
3
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
4
+ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
5
+ import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
6
+ var _excluded = ["colIndex", "visibleRowIndex"];
7
+
8
+ 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; }
9
+
10
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
11
+
12
+ /*
13
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
14
+ * or more contributor license agreements. Licensed under the Elastic License
15
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
16
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
17
+ * Side Public License, v 1.
18
+ */
19
+ import React, { useState, useMemo, useCallback } from 'react';
20
+ import classNames from 'classnames';
21
+ import { useDefaultColumnWidth, useColumnWidths } from '../utils/col_widths';
22
+ import { useRowHeightUtils, useDefaultRowHeight } from '../utils/row_heights';
23
+ import { useDataGridHeader } from './header';
24
+ import { useDataGridFooter } from './footer';
25
+ import { Cell } from './data_grid_cell_wrapper';
26
+ import { jsx as ___EmotionJSX } from "@emotion/react";
27
+ export var EuiDataGridBodyCustomRender = function EuiDataGridBodyCustomRender(_ref) {
28
+ var renderCustomGridBody = _ref.renderCustomGridBody,
29
+ leadingControlColumns = _ref.leadingControlColumns,
30
+ trailingControlColumns = _ref.trailingControlColumns,
31
+ columns = _ref.columns,
32
+ visibleColCount = _ref.visibleColCount,
33
+ schema = _ref.schema,
34
+ schemaDetectors = _ref.schemaDetectors,
35
+ visibleRows = _ref.visibleRows,
36
+ renderCellValue = _ref.renderCellValue,
37
+ renderCellPopover = _ref.renderCellPopover,
38
+ renderFooterCellValue = _ref.renderFooterCellValue,
39
+ interactiveCellId = _ref.interactiveCellId,
40
+ headerIsInteractive = _ref.headerIsInteractive,
41
+ handleHeaderMutation = _ref.handleHeaderMutation,
42
+ setVisibleColumns = _ref.setVisibleColumns,
43
+ switchColumnPos = _ref.switchColumnPos,
44
+ onColumnResize = _ref.onColumnResize,
45
+ gridWidth = _ref.gridWidth,
46
+ gridStyles = _ref.gridStyles,
47
+ pagination = _ref.pagination,
48
+ rowHeightsOptions = _ref.rowHeightsOptions;
49
+
50
+ /**
51
+ * Columns & widths
52
+ */
53
+ var visibleColumns = useMemo(function () {
54
+ return [].concat(_toConsumableArray(leadingControlColumns), _toConsumableArray(columns), _toConsumableArray(trailingControlColumns));
55
+ }, [columns, leadingControlColumns, trailingControlColumns]); // compute the default column width from the container's width and count of visible columns
56
+
57
+ var defaultColumnWidth = useDefaultColumnWidth(gridWidth, leadingControlColumns, trailingControlColumns, columns);
58
+
59
+ var _useColumnWidths = useColumnWidths({
60
+ columns: columns,
61
+ leadingControlColumns: leadingControlColumns,
62
+ trailingControlColumns: trailingControlColumns,
63
+ defaultColumnWidth: defaultColumnWidth,
64
+ onColumnResize: onColumnResize
65
+ }),
66
+ columnWidths = _useColumnWidths.columnWidths,
67
+ setColumnWidth = _useColumnWidths.setColumnWidth;
68
+ /**
69
+ * Row heights
70
+ */
71
+
72
+
73
+ var rowHeightUtils = useRowHeightUtils({
74
+ rowHeightsOptions: rowHeightsOptions,
75
+ gridStyles: gridStyles,
76
+ columns: columns
77
+ });
78
+
79
+ var _useDefaultRowHeight = useDefaultRowHeight({
80
+ rowHeightsOptions: rowHeightsOptions,
81
+ rowHeightUtils: rowHeightUtils
82
+ }),
83
+ setRowHeight = _useDefaultRowHeight.setRowHeight,
84
+ getRowHeight = _useDefaultRowHeight.getRowHeight;
85
+ /**
86
+ * Header & footer
87
+ */
88
+
89
+
90
+ var _useDataGridHeader = useDataGridHeader({
91
+ headerIsInteractive: headerIsInteractive,
92
+ handleHeaderMutation: handleHeaderMutation,
93
+ switchColumnPos: switchColumnPos,
94
+ setVisibleColumns: setVisibleColumns,
95
+ leadingControlColumns: leadingControlColumns,
96
+ trailingControlColumns: trailingControlColumns,
97
+ columns: columns,
98
+ columnWidths: columnWidths,
99
+ defaultColumnWidth: defaultColumnWidth,
100
+ setColumnWidth: setColumnWidth,
101
+ schema: schema,
102
+ schemaDetectors: schemaDetectors
103
+ }),
104
+ headerRow = _useDataGridHeader.headerRow;
105
+
106
+ var _useDataGridFooter = useDataGridFooter({
107
+ renderFooterCellValue: renderFooterCellValue,
108
+ renderCellPopover: renderCellPopover,
109
+ rowIndex: visibleRows.visibleRowCount,
110
+ visibleRowIndex: visibleRows.visibleRowCount,
111
+ interactiveCellId: interactiveCellId,
112
+ leadingControlColumns: leadingControlColumns,
113
+ trailingControlColumns: trailingControlColumns,
114
+ columns: columns,
115
+ columnWidths: columnWidths,
116
+ defaultColumnWidth: defaultColumnWidth,
117
+ schema: schema
118
+ }),
119
+ footerRow = _useDataGridFooter.footerRow;
120
+ /**
121
+ * Cell render fn
122
+ */
123
+
124
+
125
+ var cellProps = {
126
+ schema: schema,
127
+ schemaDetectors: schemaDetectors,
128
+ pagination: pagination,
129
+ columns: columns,
130
+ leadingControlColumns: leadingControlColumns,
131
+ trailingControlColumns: trailingControlColumns,
132
+ visibleColCount: visibleColCount,
133
+ columnWidths: columnWidths,
134
+ defaultColumnWidth: defaultColumnWidth,
135
+ renderCellValue: renderCellValue,
136
+ renderCellPopover: renderCellPopover,
137
+ interactiveCellId: interactiveCellId,
138
+ setRowHeight: setRowHeight,
139
+ rowHeightsOptions: rowHeightsOptions,
140
+ rowHeightUtils: rowHeightUtils
141
+ };
142
+
143
+ var _Cell = useCallback(function (_ref2) {
144
+ var colIndex = _ref2.colIndex,
145
+ visibleRowIndex = _ref2.visibleRowIndex,
146
+ rest = _objectWithoutProperties(_ref2, _excluded);
147
+
148
+ var style = {
149
+ height: rowHeightUtils.isAutoHeight(visibleRowIndex, rowHeightsOptions) ? 'auto' : getRowHeight(visibleRowIndex)
150
+ };
151
+
152
+ var props = _objectSpread({
153
+ colIndex: colIndex,
154
+ visibleRowIndex: visibleRowIndex,
155
+ style: style
156
+ }, cellProps);
157
+
158
+ return ___EmotionJSX(Cell, _extends({}, props, rest));
159
+ }, [].concat(_toConsumableArray(Object.values(cellProps)), [getRowHeight]) // eslint-disable-line react-hooks/exhaustive-deps
160
+ ); // Allow consumers to pass custom props/attributes/listeners etc. to the wrapping div
161
+
162
+
163
+ var _useState = useState({}),
164
+ _useState2 = _slicedToArray(_useState, 2),
165
+ customGridBodyProps = _useState2[0],
166
+ setCustomGridBodyProps = _useState2[1];
167
+
168
+ return ___EmotionJSX("div", _extends({}, customGridBodyProps, {
169
+ className: classNames('euiDataGrid__customRenderBody', customGridBodyProps === null || customGridBodyProps === void 0 ? void 0 : customGridBodyProps.className)
170
+ }), headerRow, renderCustomGridBody({
171
+ visibleColumns: visibleColumns,
172
+ visibleRowData: visibleRows,
173
+ Cell: _Cell,
174
+ setCustomGridBodyProps: setCustomGridBodyProps
175
+ }), footerRow);
176
+ };