@elastic/eui 93.3.0 → 93.4.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 (286) hide show
  1. package/dist/eui_charts_theme.d.ts +9 -0
  2. package/dist/eui_charts_theme.js +56 -14
  3. package/dist/eui_charts_theme.js.map +1 -1
  4. package/es/components/breadcrumbs/_breadcrumb_content.js +362 -0
  5. package/es/components/breadcrumbs/_breadcrumb_content.styles.js +48 -0
  6. package/es/components/breadcrumbs/breadcrumb.js +10 -327
  7. package/es/components/breadcrumbs/breadcrumb.styles.js +5 -27
  8. package/es/components/breadcrumbs/breadcrumbs.js +4 -4
  9. package/es/components/breadcrumbs/types.js +1 -0
  10. package/es/components/button/button_group/button_group.js +16 -2
  11. package/es/components/button/button_group/button_group.styles.js +1 -1
  12. package/es/components/button/button_group/button_group_button.js +59 -5
  13. package/es/components/button/button_group/button_group_button.styles.js +39 -3
  14. package/es/components/datagrid/body/cell/data_grid_cell.js +97 -58
  15. package/es/components/datagrid/body/cell/data_grid_cell_actions.js +24 -18
  16. package/es/components/datagrid/body/cell/data_grid_cell_popover.js +64 -56
  17. package/es/components/datagrid/body/cell/data_grid_cell_wrapper.js +32 -31
  18. package/es/components/datagrid/body/cell/index.js +1 -1
  19. package/es/components/datagrid/body/data_grid_body.js +13 -0
  20. package/es/components/datagrid/body/data_grid_body_custom.js +52 -36
  21. package/es/components/datagrid/body/data_grid_body_virtualized.js +84 -56
  22. package/es/components/datagrid/body/data_grid_row_manager.js +6 -4
  23. package/es/components/datagrid/body/footer/use_data_grid_footer.js +1 -2
  24. package/es/components/datagrid/body/header/data_grid_control_header_cell.js +5 -4
  25. package/es/components/datagrid/body/header/data_grid_header_cell.js +73 -53
  26. package/es/components/datagrid/body/header/data_grid_header_row.js +15 -551
  27. package/es/components/datagrid/body/header/use_data_grid_header.js +7 -6
  28. package/es/components/datagrid/controls/column_selector.js +126 -123
  29. package/es/components/datagrid/controls/column_sorting.js +605 -103
  30. package/es/components/datagrid/controls/column_sorting_draggable.js +24 -22
  31. package/es/components/datagrid/controls/display_selector.js +109 -107
  32. package/es/components/datagrid/data_grid.a11y.js +13 -12
  33. package/es/components/datagrid/data_grid.js +45 -22
  34. package/es/components/datagrid/utils/col_widths.js +12 -8
  35. package/es/components/datagrid/utils/focus.js +10 -8
  36. package/es/components/datagrid/utils/grid_height_width.js +31 -30
  37. package/es/components/datagrid/utils/ref.js +1 -1
  38. package/es/components/datagrid/utils/row_heights.js +2 -2
  39. package/es/components/datagrid/utils/sorting.js +29 -27
  40. package/es/components/date_picker/super_date_picker/super_date_picker.js +9 -0
  41. package/es/components/date_picker/super_date_picker/super_update_button.js +57 -29
  42. package/es/components/flex/flex_grid.js +22 -8
  43. package/es/components/flex/flex_grid.styles.js +13 -6
  44. package/es/components/flex/flex_group.js +10 -11
  45. package/es/components/flex/flex_item.js +9 -11
  46. package/es/components/flex/flex_item.styles.js +107 -122
  47. package/es/components/flyout/flyout.js +16 -18
  48. package/es/components/header/header_breadcrumbs/header_breadcrumbs.js +3 -5
  49. package/es/components/modal/confirm_modal.js +2 -1
  50. package/es/components/modal/modal.js +12 -3
  51. package/es/components/observer/resize_observer/resize_observer.js +15 -24
  52. package/es/components/spacer/spacer.js +2 -3
  53. package/es/components/toast/global_toast_list.js +70 -73
  54. package/es/components/toast/toast.js +27 -42
  55. package/es/components/toast/toast.styles.js +2 -17
  56. package/es/services/color/eui_palettes.js +21 -13
  57. package/es/services/color/index.js +1 -1
  58. package/es/services/hooks/index.js +1 -0
  59. package/es/services/hooks/useDeepEqual.js +23 -0
  60. package/es/services/index.js +1 -1
  61. package/eui.d.ts +2442 -2337
  62. package/i18ntokens.json +259 -259
  63. package/lib/components/breadcrumbs/_breadcrumb_content.js +372 -0
  64. package/lib/components/breadcrumbs/_breadcrumb_content.styles.js +55 -0
  65. package/lib/components/breadcrumbs/breadcrumb.js +11 -331
  66. package/lib/components/breadcrumbs/breadcrumb.styles.js +5 -29
  67. package/lib/components/breadcrumbs/breadcrumbs.js +3 -3
  68. package/lib/components/breadcrumbs/types.js +5 -0
  69. package/lib/components/button/button_group/button_group.js +16 -2
  70. package/lib/components/button/button_group/button_group.styles.js +1 -1
  71. package/lib/components/button/button_group/button_group_button.js +59 -5
  72. package/lib/components/button/button_group/button_group_button.styles.js +45 -11
  73. package/lib/components/datagrid/body/cell/data_grid_cell.js +95 -57
  74. package/lib/components/datagrid/body/cell/data_grid_cell_actions.js +24 -18
  75. package/lib/components/datagrid/body/cell/data_grid_cell_popover.js +63 -55
  76. package/lib/components/datagrid/body/cell/data_grid_cell_wrapper.js +32 -31
  77. package/lib/components/datagrid/body/cell/index.js +2 -2
  78. package/lib/components/datagrid/body/data_grid_body.js +13 -0
  79. package/lib/components/datagrid/body/data_grid_body_custom.js +51 -35
  80. package/lib/components/datagrid/body/data_grid_body_virtualized.js +83 -55
  81. package/lib/components/datagrid/body/data_grid_row_manager.js +5 -3
  82. package/lib/components/datagrid/body/footer/use_data_grid_footer.js +1 -2
  83. package/lib/components/datagrid/body/header/data_grid_control_header_cell.js +8 -4
  84. package/lib/components/datagrid/body/header/data_grid_header_cell.js +72 -52
  85. package/lib/components/datagrid/body/header/data_grid_header_row.js +14 -550
  86. package/lib/components/datagrid/body/header/use_data_grid_header.js +7 -6
  87. package/lib/components/datagrid/controls/column_selector.js +126 -123
  88. package/lib/components/datagrid/controls/column_sorting.js +615 -110
  89. package/lib/components/datagrid/controls/column_sorting_draggable.js +27 -22
  90. package/lib/components/datagrid/controls/display_selector.js +109 -107
  91. package/lib/components/datagrid/data_grid.a11y.js +13 -12
  92. package/lib/components/datagrid/data_grid.js +43 -20
  93. package/lib/components/datagrid/utils/col_widths.js +12 -8
  94. package/lib/components/datagrid/utils/focus.js +10 -8
  95. package/lib/components/datagrid/utils/grid_height_width.js +29 -28
  96. package/lib/components/datagrid/utils/ref.js +1 -1
  97. package/lib/components/datagrid/utils/row_heights.js +1 -1
  98. package/lib/components/datagrid/utils/sorting.js +31 -29
  99. package/lib/components/date_picker/super_date_picker/super_date_picker.js +9 -0
  100. package/lib/components/date_picker/super_date_picker/super_update_button.js +57 -29
  101. package/lib/components/flex/flex_grid.js +23 -7
  102. package/lib/components/flex/flex_grid.styles.js +13 -6
  103. package/lib/components/flex/flex_group.js +10 -10
  104. package/lib/components/flex/flex_item.js +13 -13
  105. package/lib/components/flex/flex_item.styles.js +107 -122
  106. package/lib/components/flyout/flyout.js +16 -18
  107. package/lib/components/header/header_breadcrumbs/header_breadcrumbs.js +3 -5
  108. package/lib/components/modal/confirm_modal.js +2 -1
  109. package/lib/components/modal/modal.js +12 -3
  110. package/lib/components/observer/resize_observer/resize_observer.js +15 -24
  111. package/lib/components/spacer/spacer.js +1 -2
  112. package/lib/components/toast/global_toast_list.js +68 -71
  113. package/lib/components/toast/toast.js +25 -40
  114. package/lib/components/toast/toast.styles.js +11 -25
  115. package/lib/services/color/eui_palettes.js +24 -14
  116. package/lib/services/color/index.js +14 -0
  117. package/lib/services/hooks/index.js +11 -0
  118. package/lib/services/hooks/useDeepEqual.js +30 -0
  119. package/lib/services/index.js +15 -1
  120. package/optimize/es/components/breadcrumbs/_breadcrumb_content.js +153 -0
  121. package/optimize/es/components/breadcrumbs/_breadcrumb_content.styles.js +48 -0
  122. package/optimize/es/components/breadcrumbs/breadcrumb.js +10 -110
  123. package/optimize/es/components/breadcrumbs/breadcrumb.styles.js +5 -27
  124. package/optimize/es/components/breadcrumbs/breadcrumbs.js +4 -4
  125. package/optimize/es/components/breadcrumbs/types.js +1 -0
  126. package/optimize/es/components/button/button_group/button_group.js +2 -2
  127. package/optimize/es/components/button/button_group/button_group.styles.js +1 -1
  128. package/optimize/es/components/button/button_group/button_group_button.js +36 -4
  129. package/optimize/es/components/button/button_group/button_group_button.styles.js +39 -3
  130. package/optimize/es/components/datagrid/body/cell/data_grid_cell.js +80 -55
  131. package/optimize/es/components/datagrid/body/cell/data_grid_cell_actions.js +24 -18
  132. package/optimize/es/components/datagrid/body/cell/data_grid_cell_popover.js +64 -56
  133. package/optimize/es/components/datagrid/body/cell/data_grid_cell_wrapper.js +32 -31
  134. package/optimize/es/components/datagrid/body/cell/index.js +1 -1
  135. package/optimize/es/components/datagrid/body/data_grid_body_custom.js +39 -36
  136. package/optimize/es/components/datagrid/body/data_grid_body_virtualized.js +69 -49
  137. package/optimize/es/components/datagrid/body/data_grid_row_manager.js +6 -4
  138. package/optimize/es/components/datagrid/body/footer/use_data_grid_footer.js +1 -2
  139. package/optimize/es/components/datagrid/body/header/data_grid_control_header_cell.js +4 -3
  140. package/optimize/es/components/datagrid/body/header/data_grid_header_cell.js +65 -49
  141. package/optimize/es/components/datagrid/body/header/data_grid_header_row.js +15 -13
  142. package/optimize/es/components/datagrid/body/header/use_data_grid_header.js +7 -6
  143. package/optimize/es/components/datagrid/controls/column_selector.js +126 -123
  144. package/optimize/es/components/datagrid/controls/column_sorting.js +121 -103
  145. package/optimize/es/components/datagrid/controls/column_sorting_draggable.js +24 -22
  146. package/optimize/es/components/datagrid/controls/display_selector.js +109 -107
  147. package/optimize/es/components/datagrid/data_grid.a11y.js +13 -12
  148. package/optimize/es/components/datagrid/data_grid.js +45 -22
  149. package/optimize/es/components/datagrid/utils/col_widths.js +9 -5
  150. package/optimize/es/components/datagrid/utils/focus.js +10 -8
  151. package/optimize/es/components/datagrid/utils/grid_height_width.js +31 -30
  152. package/optimize/es/components/datagrid/utils/ref.js +1 -1
  153. package/optimize/es/components/datagrid/utils/row_heights.js +2 -2
  154. package/optimize/es/components/datagrid/utils/sorting.js +29 -27
  155. package/optimize/es/components/date_picker/super_date_picker/super_update_button.js +49 -29
  156. package/optimize/es/components/flex/flex_grid.js +19 -8
  157. package/optimize/es/components/flex/flex_grid.styles.js +13 -6
  158. package/optimize/es/components/flex/flex_group.js +9 -10
  159. package/optimize/es/components/flex/flex_item.js +9 -11
  160. package/optimize/es/components/flex/flex_item.styles.js +107 -122
  161. package/optimize/es/components/flyout/flyout.js +16 -18
  162. package/optimize/es/components/header/header_breadcrumbs/header_breadcrumbs.js +3 -5
  163. package/optimize/es/components/modal/confirm_modal.js +2 -1
  164. package/optimize/es/components/modal/modal.js +6 -2
  165. package/optimize/es/components/observer/resize_observer/resize_observer.js +15 -24
  166. package/optimize/es/components/spacer/spacer.js +2 -3
  167. package/optimize/es/components/toast/global_toast_list.js +70 -73
  168. package/optimize/es/components/toast/toast.js +27 -42
  169. package/optimize/es/components/toast/toast.styles.js +2 -17
  170. package/optimize/es/services/color/eui_palettes.js +21 -13
  171. package/optimize/es/services/color/index.js +1 -1
  172. package/optimize/es/services/hooks/index.js +1 -0
  173. package/optimize/es/services/hooks/useDeepEqual.js +23 -0
  174. package/optimize/es/services/index.js +1 -1
  175. package/optimize/lib/components/breadcrumbs/_breadcrumb_content.js +163 -0
  176. package/optimize/lib/components/breadcrumbs/_breadcrumb_content.styles.js +55 -0
  177. package/optimize/lib/components/breadcrumbs/breadcrumb.js +10 -113
  178. package/optimize/lib/components/breadcrumbs/breadcrumb.styles.js +5 -29
  179. package/optimize/lib/components/breadcrumbs/breadcrumbs.js +3 -3
  180. package/optimize/lib/components/breadcrumbs/types.js +5 -0
  181. package/optimize/lib/components/button/button_group/button_group.js +2 -2
  182. package/optimize/lib/components/button/button_group/button_group.styles.js +1 -1
  183. package/optimize/lib/components/button/button_group/button_group_button.js +37 -5
  184. package/optimize/lib/components/button/button_group/button_group_button.styles.js +45 -11
  185. package/optimize/lib/components/datagrid/body/cell/data_grid_cell.js +78 -54
  186. package/optimize/lib/components/datagrid/body/cell/data_grid_cell_actions.js +24 -18
  187. package/optimize/lib/components/datagrid/body/cell/data_grid_cell_popover.js +63 -55
  188. package/optimize/lib/components/datagrid/body/cell/data_grid_cell_wrapper.js +32 -31
  189. package/optimize/lib/components/datagrid/body/cell/index.js +2 -2
  190. package/optimize/lib/components/datagrid/body/data_grid_body_custom.js +38 -35
  191. package/optimize/lib/components/datagrid/body/data_grid_body_virtualized.js +70 -50
  192. package/optimize/lib/components/datagrid/body/data_grid_row_manager.js +5 -3
  193. package/optimize/lib/components/datagrid/body/footer/use_data_grid_footer.js +1 -2
  194. package/optimize/lib/components/datagrid/body/header/data_grid_control_header_cell.js +8 -4
  195. package/optimize/lib/components/datagrid/body/header/data_grid_header_cell.js +65 -49
  196. package/optimize/lib/components/datagrid/body/header/data_grid_header_row.js +14 -12
  197. package/optimize/lib/components/datagrid/body/header/use_data_grid_header.js +7 -6
  198. package/optimize/lib/components/datagrid/controls/column_selector.js +126 -123
  199. package/optimize/lib/components/datagrid/controls/column_sorting.js +125 -107
  200. package/optimize/lib/components/datagrid/controls/column_sorting_draggable.js +27 -22
  201. package/optimize/lib/components/datagrid/controls/display_selector.js +109 -107
  202. package/optimize/lib/components/datagrid/data_grid.a11y.js +13 -12
  203. package/optimize/lib/components/datagrid/data_grid.js +43 -20
  204. package/optimize/lib/components/datagrid/utils/col_widths.js +9 -5
  205. package/optimize/lib/components/datagrid/utils/focus.js +10 -8
  206. package/optimize/lib/components/datagrid/utils/grid_height_width.js +29 -28
  207. package/optimize/lib/components/datagrid/utils/ref.js +1 -1
  208. package/optimize/lib/components/datagrid/utils/row_heights.js +1 -1
  209. package/optimize/lib/components/datagrid/utils/sorting.js +31 -29
  210. package/optimize/lib/components/date_picker/super_date_picker/super_update_button.js +49 -29
  211. package/optimize/lib/components/flex/flex_grid.js +21 -7
  212. package/optimize/lib/components/flex/flex_grid.styles.js +13 -6
  213. package/optimize/lib/components/flex/flex_group.js +9 -9
  214. package/optimize/lib/components/flex/flex_item.js +13 -13
  215. package/optimize/lib/components/flex/flex_item.styles.js +107 -122
  216. package/optimize/lib/components/flyout/flyout.js +16 -18
  217. package/optimize/lib/components/header/header_breadcrumbs/header_breadcrumbs.js +3 -5
  218. package/optimize/lib/components/modal/confirm_modal.js +2 -1
  219. package/optimize/lib/components/modal/modal.js +6 -2
  220. package/optimize/lib/components/observer/resize_observer/resize_observer.js +15 -24
  221. package/optimize/lib/components/spacer/spacer.js +1 -2
  222. package/optimize/lib/components/toast/global_toast_list.js +68 -71
  223. package/optimize/lib/components/toast/toast.js +25 -40
  224. package/optimize/lib/components/toast/toast.styles.js +11 -25
  225. package/optimize/lib/services/color/eui_palettes.js +24 -14
  226. package/optimize/lib/services/color/index.js +14 -0
  227. package/optimize/lib/services/hooks/index.js +11 -0
  228. package/optimize/lib/services/hooks/useDeepEqual.js +30 -0
  229. package/optimize/lib/services/index.js +15 -1
  230. package/package.json +2 -2
  231. package/test-env/components/breadcrumbs/_breadcrumb_content.js +363 -0
  232. package/test-env/components/breadcrumbs/_breadcrumb_content.styles.js +55 -0
  233. package/test-env/components/breadcrumbs/breadcrumb.js +11 -326
  234. package/test-env/components/breadcrumbs/breadcrumb.styles.js +5 -29
  235. package/test-env/components/breadcrumbs/breadcrumbs.js +3 -3
  236. package/test-env/components/breadcrumbs/types.js +5 -0
  237. package/test-env/components/button/button_group/button_group.js +16 -2
  238. package/test-env/components/button/button_group/button_group.styles.js +1 -1
  239. package/test-env/components/button/button_group/button_group_button.js +56 -5
  240. package/test-env/components/button/button_group/button_group_button.styles.js +45 -11
  241. package/test-env/components/datagrid/body/cell/data_grid_cell.js +95 -57
  242. package/test-env/components/datagrid/body/cell/data_grid_cell_actions.js +24 -18
  243. package/test-env/components/datagrid/body/cell/data_grid_cell_popover.js +63 -55
  244. package/test-env/components/datagrid/body/cell/data_grid_cell_wrapper.js +32 -31
  245. package/test-env/components/datagrid/body/cell/index.js +2 -2
  246. package/test-env/components/datagrid/body/data_grid_body.js +13 -0
  247. package/test-env/components/datagrid/body/data_grid_body_custom.js +51 -35
  248. package/test-env/components/datagrid/body/data_grid_body_virtualized.js +83 -55
  249. package/test-env/components/datagrid/body/data_grid_row_manager.js +5 -3
  250. package/test-env/components/datagrid/body/footer/use_data_grid_footer.js +1 -2
  251. package/test-env/components/datagrid/body/header/data_grid_control_header_cell.js +8 -4
  252. package/test-env/components/datagrid/body/header/data_grid_header_cell.js +72 -52
  253. package/test-env/components/datagrid/body/header/data_grid_header_row.js +14 -550
  254. package/test-env/components/datagrid/body/header/use_data_grid_header.js +7 -6
  255. package/test-env/components/datagrid/controls/column_selector.js +126 -123
  256. package/test-env/components/datagrid/controls/column_sorting.js +607 -106
  257. package/test-env/components/datagrid/controls/column_sorting_draggable.js +27 -22
  258. package/test-env/components/datagrid/controls/display_selector.js +109 -107
  259. package/test-env/components/datagrid/data_grid.a11y.js +13 -12
  260. package/test-env/components/datagrid/data_grid.js +43 -20
  261. package/test-env/components/datagrid/utils/col_widths.js +9 -5
  262. package/test-env/components/datagrid/utils/focus.js +10 -8
  263. package/test-env/components/datagrid/utils/grid_height_width.js +29 -28
  264. package/test-env/components/datagrid/utils/ref.js +1 -1
  265. package/test-env/components/datagrid/utils/row_heights.js +1 -1
  266. package/test-env/components/datagrid/utils/sorting.js +31 -29
  267. package/test-env/components/date_picker/super_date_picker/super_date_picker.js +9 -0
  268. package/test-env/components/date_picker/super_date_picker/super_update_button.js +57 -29
  269. package/test-env/components/flex/flex_grid.js +21 -7
  270. package/test-env/components/flex/flex_grid.styles.js +13 -6
  271. package/test-env/components/flex/flex_group.js +10 -10
  272. package/test-env/components/flex/flex_item.js +13 -13
  273. package/test-env/components/flex/flex_item.styles.js +107 -122
  274. package/test-env/components/header/header_breadcrumbs/header_breadcrumbs.js +3 -5
  275. package/test-env/components/modal/confirm_modal.js +2 -1
  276. package/test-env/components/modal/modal.js +12 -3
  277. package/test-env/components/spacer/spacer.js +1 -2
  278. package/test-env/components/toast/global_toast_list.js +68 -71
  279. package/test-env/components/toast/toast.js +25 -40
  280. package/test-env/components/toast/toast.styles.js +11 -25
  281. package/test-env/services/color/eui_palettes.js +24 -14
  282. package/test-env/services/color/index.js +14 -0
  283. package/test-env/services/hooks/index.js +11 -0
  284. package/test-env/services/hooks/useDeepEqual.js +30 -0
  285. package/test-env/services/index.js +15 -1
  286. package/src/themes/charts/theme.scss +0 -5
@@ -1,10 +1,11 @@
1
1
  "use strict";
2
2
 
3
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
3
4
  Object.defineProperty(exports, "__esModule", {
4
5
  value: true
5
6
  });
6
7
  exports.defaultSortDescLabel = exports.defaultSortAscLabel = exports.EuiDataGridColumnSortingDraggable = void 0;
7
- var _react = _interopRequireDefault(require("react"));
8
+ var _react = _interopRequireWildcard(require("react"));
8
9
  var _propTypes = _interopRequireDefault(require("prop-types"));
9
10
  var _classnames = _interopRequireDefault(require("classnames"));
10
11
  var _accessibility = require("../../accessibility");
@@ -26,6 +27,8 @@ var _excluded = ["id", "display", "direction", "index", "sorting", "schema", "sc
26
27
  * Side Public License, v 1.
27
28
  */
28
29
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
30
+ 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); }
31
+ 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; }
29
32
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
30
33
  function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
31
34
  function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
@@ -69,6 +72,27 @@ var EuiDataGridColumnSortingDraggable = function EuiDataGridColumnSortingDraggab
69
72
  'data-test-subj': "euiDataGridColumnSorting-sortColumn-".concat(id, "-desc")
70
73
  }];
71
74
  var dragHandleAriaLabel = (0, _i18n.useEuiI18n)('euiColumnSortingDraggable.dragHandleAriaLabel', 'Drag handle');
75
+ var removeSort = (0, _react.useCallback)(function () {
76
+ var nextColumns = _toConsumableArray(sorting.columns);
77
+ var columnIndex = nextColumns.map(function (_ref2) {
78
+ var id = _ref2.id;
79
+ return id;
80
+ }).indexOf(id);
81
+ nextColumns.splice(columnIndex, 1);
82
+ sorting.onSort(nextColumns);
83
+ }, [id, sorting]);
84
+ var toggleLegendHandler = (0, _react.useCallback)(function (_, direction) {
85
+ var nextColumns = _toConsumableArray(sorting.columns);
86
+ var columnIndex = nextColumns.map(function (_ref3) {
87
+ var id = _ref3.id;
88
+ return id;
89
+ }).indexOf(id);
90
+ nextColumns.splice(columnIndex, 1, {
91
+ id: id,
92
+ direction: direction
93
+ });
94
+ sorting.onSort(nextColumns);
95
+ }, [id, sorting]);
72
96
  return (0, _react2.jsx)(_drag_and_drop.EuiDraggable, _extends({
73
97
  draggableId: id,
74
98
  index: index,
@@ -106,15 +130,7 @@ var EuiDataGridColumnSortingDraggable = function EuiDataGridColumnSortingDraggab
106
130
  className: "euiDataGridColumnSorting__button",
107
131
  "aria-label": removeSortLabel,
108
132
  iconType: "cross",
109
- onClick: function onClick() {
110
- var nextColumns = _toConsumableArray(sorting.columns);
111
- var columnIndex = nextColumns.map(function (_ref2) {
112
- var id = _ref2.id;
113
- return id;
114
- }).indexOf(id);
115
- nextColumns.splice(columnIndex, 1);
116
- sorting.onSort(nextColumns);
117
- }
133
+ onClick: removeSort
118
134
  });
119
135
  })), (0, _react2.jsx)(_flex.EuiFlexItem, _extends({
120
136
  className: "euiDataGridColumnSorting__name"
@@ -149,18 +165,7 @@ var EuiDataGridColumnSortingDraggable = function EuiDataGridColumnSortingDraggab
149
165
  buttonSize: "compressed",
150
166
  className: "euiDataGridColumnSorting__order",
151
167
  idSelected: direction === 'asc' ? "".concat(id, "Asc") : "".concat(id, "Desc"),
152
- onChange: function onChange(_, direction) {
153
- var nextColumns = _toConsumableArray(sorting.columns);
154
- var columnIndex = nextColumns.map(function (_ref3) {
155
- var id = _ref3.id;
156
- return id;
157
- }).indexOf(id);
158
- nextColumns.splice(columnIndex, 1, {
159
- id: id,
160
- direction: direction
161
- });
162
- sorting.onSort(nextColumns);
163
- }
168
+ onChange: toggleLegendHandler
164
169
  });
165
170
  })), (0, _react2.jsx)(_flex.EuiFlexItem, _extends({
166
171
  grow: false
@@ -210,114 +210,116 @@ var useDataGridDisplaySelector = function useDataGridDisplaySelector(showDisplay
210
210
  }, []);
211
211
  var buttonLabel = (0, _i18n.useEuiI18n)('euiDisplaySelector.buttonText', 'Display options');
212
212
  var resetButtonLabel = (0, _i18n.useEuiI18n)('euiDisplaySelector.resetButtonText', 'Reset to default');
213
- var displaySelector = showDensityControls || showRowHeightControls || additionalDisplaySettings ? (0, _react2.jsx)(_popover.EuiPopover, {
214
- "data-test-subj": "dataGridDisplaySelectorPopover",
215
- isOpen: isOpen,
216
- closePopover: function closePopover() {
217
- return setIsOpen(false);
218
- },
219
- anchorPosition: "downRight",
220
- panelPaddingSize: "s",
221
- panelClassName: "euiDataGrid__displayPopoverPanel",
222
- button: (0, _react2.jsx)(_tool_tip.EuiToolTip, {
223
- content: buttonLabel,
224
- delay: "long"
225
- }, (0, _react2.jsx)(_button.EuiButtonIcon, {
226
- size: "xs",
227
- iconType: "controlsHorizontal",
228
- color: "text",
229
- "data-test-subj": "dataGridDisplaySelectorButton",
230
- onClick: function onClick() {
231
- return setIsOpen(!isOpen);
213
+ var displaySelector = (0, _react.useMemo)(function () {
214
+ return showDensityControls || showRowHeightControls || additionalDisplaySettings ? (0, _react2.jsx)(_popover.EuiPopover, {
215
+ "data-test-subj": "dataGridDisplaySelectorPopover",
216
+ isOpen: isOpen,
217
+ closePopover: function closePopover() {
218
+ return setIsOpen(false);
232
219
  },
233
- "aria-label": buttonLabel
234
- }))
235
- }, showDensityControls && (0, _react2.jsx)(_i18n.EuiI18n, {
236
- tokens: ['euiDisplaySelector.densityLabel', 'euiDisplaySelector.labelCompact', 'euiDisplaySelector.labelNormal', 'euiDisplaySelector.labelExpanded'],
237
- defaults: ['Density', 'Compact', 'Normal', 'Expanded']
238
- }, function (_ref) {
239
- var _ref2 = _slicedToArray(_ref, 4),
240
- densityLabel = _ref2[0],
241
- labelCompact = _ref2[1],
242
- labelNormal = _ref2[2],
243
- labelExpanded = _ref2[3];
244
- return (0, _react2.jsx)(_form.EuiFormRow, {
245
- label: densityLabel,
246
- display: "columnCompressed"
247
- }, (0, _react2.jsx)(_button.EuiButtonGroup, {
248
- legend: densityLabel,
249
- buttonSize: "compressed",
250
- isFullWidth: true,
251
- options: [{
252
- id: densityOptions[0],
253
- label: labelCompact
254
- }, {
255
- id: densityOptions[1],
256
- label: labelNormal
257
- }, {
258
- id: densityOptions[2],
259
- label: labelExpanded
260
- }],
261
- onChange: setGridStyles,
262
- idSelected: gridDensity,
263
- "data-test-subj": "densityButtonGroup"
264
- }));
265
- }), showRowHeightControls && (0, _react2.jsx)(_i18n.EuiI18n, {
266
- tokens: ['euiDisplaySelector.rowHeightLabel', 'euiDisplaySelector.labelSingle', 'euiDisplaySelector.labelAuto', 'euiDisplaySelector.labelCustom', 'euiDisplaySelector.lineCountLabel'],
267
- defaults: ['Row height', 'Single', 'Auto fit', 'Custom', 'Lines per row']
268
- }, function (_ref3) {
269
- var _ref4 = _slicedToArray(_ref3, 5),
270
- rowHeightLabel = _ref4[0],
271
- labelSingle = _ref4[1],
272
- labelAuto = _ref4[2],
273
- labelCustom = _ref4[3],
274
- lineCountLabel = _ref4[4];
275
- return (0, _react2.jsx)(_react.default.Fragment, null, (0, _react2.jsx)(_form.EuiFormRow, {
276
- label: rowHeightLabel,
277
- display: "columnCompressed"
278
- }, (0, _react2.jsx)(_button.EuiButtonGroup, {
279
- legend: rowHeightLabel,
280
- buttonSize: "compressed",
281
- isFullWidth: true,
282
- options: [{
283
- id: rowHeightButtonOptions[0],
284
- label: labelSingle
285
- }, {
286
- id: rowHeightButtonOptions[1],
287
- label: labelAuto
288
- }, {
289
- id: rowHeightButtonOptions[2],
290
- label: labelCustom
291
- }],
292
- onChange: setRowHeight,
293
- idSelected: rowHeightSelection,
294
- "data-test-subj": "rowHeightButtonGroup"
295
- })), rowHeightSelection === rowHeightButtonOptions[2] && (0, _react2.jsx)(_form.EuiFormRow, {
296
- label: lineCountLabel,
297
- display: "columnCompressed"
298
- }, (0, _react2.jsx)(_form.EuiRange, {
299
- compressed: true,
300
- fullWidth: true,
301
- showInput: true,
302
- min: 1,
303
- max: 20,
304
- step: 1,
305
- required: true,
306
- value: lineCountInput,
307
- onChange: setLineCountHeight,
308
- "data-test-subj": "lineCountNumber"
309
- })));
310
- }), additionalDisplaySettings, showResetButton && (0, _react2.jsx)(_popover.EuiPopoverFooter, null, (0, _react2.jsx)(_flex.EuiFlexGroup, {
311
- justifyContent: "flexEnd",
312
- responsive: false
313
- }, (0, _react2.jsx)(_flex.EuiFlexItem, {
314
- grow: false
315
- }, (0, _react2.jsx)("div", null, (0, _react2.jsx)(_button.EuiButtonEmpty, {
316
- flush: "both",
317
- size: "xs",
318
- onClick: resetToInitialState,
319
- "data-test-subj": "resetDisplaySelector"
320
- }, resetButtonLabel)))))) : null;
220
+ anchorPosition: "downRight",
221
+ panelPaddingSize: "s",
222
+ panelClassName: "euiDataGrid__displayPopoverPanel",
223
+ button: (0, _react2.jsx)(_tool_tip.EuiToolTip, {
224
+ content: buttonLabel,
225
+ delay: "long"
226
+ }, (0, _react2.jsx)(_button.EuiButtonIcon, {
227
+ size: "xs",
228
+ iconType: "controlsHorizontal",
229
+ color: "text",
230
+ "data-test-subj": "dataGridDisplaySelectorButton",
231
+ onClick: function onClick() {
232
+ return setIsOpen(!isOpen);
233
+ },
234
+ "aria-label": buttonLabel
235
+ }))
236
+ }, showDensityControls && (0, _react2.jsx)(_i18n.EuiI18n, {
237
+ tokens: ['euiDisplaySelector.densityLabel', 'euiDisplaySelector.labelCompact', 'euiDisplaySelector.labelNormal', 'euiDisplaySelector.labelExpanded'],
238
+ defaults: ['Density', 'Compact', 'Normal', 'Expanded']
239
+ }, function (_ref) {
240
+ var _ref2 = _slicedToArray(_ref, 4),
241
+ densityLabel = _ref2[0],
242
+ labelCompact = _ref2[1],
243
+ labelNormal = _ref2[2],
244
+ labelExpanded = _ref2[3];
245
+ return (0, _react2.jsx)(_form.EuiFormRow, {
246
+ label: densityLabel,
247
+ display: "columnCompressed"
248
+ }, (0, _react2.jsx)(_button.EuiButtonGroup, {
249
+ legend: densityLabel,
250
+ buttonSize: "compressed",
251
+ isFullWidth: true,
252
+ options: [{
253
+ id: densityOptions[0],
254
+ label: labelCompact
255
+ }, {
256
+ id: densityOptions[1],
257
+ label: labelNormal
258
+ }, {
259
+ id: densityOptions[2],
260
+ label: labelExpanded
261
+ }],
262
+ onChange: setGridStyles,
263
+ idSelected: gridDensity,
264
+ "data-test-subj": "densityButtonGroup"
265
+ }));
266
+ }), showRowHeightControls && (0, _react2.jsx)(_i18n.EuiI18n, {
267
+ tokens: ['euiDisplaySelector.rowHeightLabel', 'euiDisplaySelector.labelSingle', 'euiDisplaySelector.labelAuto', 'euiDisplaySelector.labelCustom', 'euiDisplaySelector.lineCountLabel'],
268
+ defaults: ['Row height', 'Single', 'Auto fit', 'Custom', 'Lines per row']
269
+ }, function (_ref3) {
270
+ var _ref4 = _slicedToArray(_ref3, 5),
271
+ rowHeightLabel = _ref4[0],
272
+ labelSingle = _ref4[1],
273
+ labelAuto = _ref4[2],
274
+ labelCustom = _ref4[3],
275
+ lineCountLabel = _ref4[4];
276
+ return (0, _react2.jsx)(_react.default.Fragment, null, (0, _react2.jsx)(_form.EuiFormRow, {
277
+ label: rowHeightLabel,
278
+ display: "columnCompressed"
279
+ }, (0, _react2.jsx)(_button.EuiButtonGroup, {
280
+ legend: rowHeightLabel,
281
+ buttonSize: "compressed",
282
+ isFullWidth: true,
283
+ options: [{
284
+ id: rowHeightButtonOptions[0],
285
+ label: labelSingle
286
+ }, {
287
+ id: rowHeightButtonOptions[1],
288
+ label: labelAuto
289
+ }, {
290
+ id: rowHeightButtonOptions[2],
291
+ label: labelCustom
292
+ }],
293
+ onChange: setRowHeight,
294
+ idSelected: rowHeightSelection,
295
+ "data-test-subj": "rowHeightButtonGroup"
296
+ })), rowHeightSelection === rowHeightButtonOptions[2] && (0, _react2.jsx)(_form.EuiFormRow, {
297
+ label: lineCountLabel,
298
+ display: "columnCompressed"
299
+ }, (0, _react2.jsx)(_form.EuiRange, {
300
+ compressed: true,
301
+ fullWidth: true,
302
+ showInput: true,
303
+ min: 1,
304
+ max: 20,
305
+ step: 1,
306
+ required: true,
307
+ value: lineCountInput,
308
+ onChange: setLineCountHeight,
309
+ "data-test-subj": "lineCountNumber"
310
+ })));
311
+ }), additionalDisplaySettings, showResetButton && (0, _react2.jsx)(_popover.EuiPopoverFooter, null, (0, _react2.jsx)(_flex.EuiFlexGroup, {
312
+ justifyContent: "flexEnd",
313
+ responsive: false
314
+ }, (0, _react2.jsx)(_flex.EuiFlexItem, {
315
+ grow: false
316
+ }, (0, _react2.jsx)("div", null, (0, _react2.jsx)(_button.EuiButtonEmpty, {
317
+ flush: "both",
318
+ size: "xs",
319
+ onClick: resetToInitialState,
320
+ "data-test-subj": "resetDisplaySelector"
321
+ }, resetButtonLabel)))))) : null;
322
+ }, [additionalDisplaySettings, buttonLabel, isOpen, resetButtonLabel, showDensityControls, showResetButton, showRowHeightControls, gridDensity, rowHeightSelection, lineCountInput, setGridStyles, setRowHeight, setLineCountHeight, resetToInitialState]);
321
323
  return [displaySelector, gridStyles, rowHeightsOptions];
322
324
  };
323
325
  exports.useDataGridDisplaySelector = useDataGridDisplaySelector;
@@ -75,9 +75,19 @@ var commaSeparateNumbers = function commaSeparateNumbers(numberString) {
75
75
  );
76
76
  });
77
77
  };
78
+ var renderCellValue = function renderCellValue(_ref2) {
79
+ var rowIndex = _ref2.rowIndex,
80
+ columnId = _ref2.columnId,
81
+ schema = _ref2.schema;
82
+ var value = storeData[rowIndex][columnId];
83
+ if (schema === 'numeric') {
84
+ value = commaSeparateNumbers(value);
85
+ }
86
+ return value;
87
+ };
78
88
  var DataGrid = function DataGrid() {
79
- var _useState = (0, _react.useState)(columns.map(function (_ref2) {
80
- var id = _ref2.id;
89
+ var _useState = (0, _react.useState)(columns.map(function (_ref3) {
90
+ var id = _ref3.id;
81
91
  return id;
82
92
  })),
83
93
  _useState2 = _slicedToArray(_useState, 2),
@@ -119,16 +129,7 @@ var DataGrid = function DataGrid() {
119
129
  inMemory: {
120
130
  level: 'sorting'
121
131
  },
122
- renderCellValue: function renderCellValue(_ref3) {
123
- var rowIndex = _ref3.rowIndex,
124
- columnId = _ref3.columnId,
125
- schema = _ref3.schema;
126
- var value = data[rowIndex][columnId];
127
- if (schema === 'numeric') {
128
- value = commaSeparateNumbers(value);
129
- }
130
- return value;
131
- },
132
+ renderCellValue: renderCellValue,
132
133
  sorting: {
133
134
  columns: sortingColumns,
134
135
  onSort: setSorting
@@ -25,8 +25,7 @@ var _data_grid_schema = require("./utils/data_grid_schema");
25
25
  var _ref = require("./utils/ref");
26
26
  var _data_grid_types = require("./data_grid_types");
27
27
  var _react2 = require("@emotion/react");
28
- var _excluded = ["leadingControlColumns", "trailingControlColumns", "columns", "columnVisibility", "schemaDetectors", "rowCount", "renderCellValue", "cellContext", "renderCellPopover", "renderFooterCellValue", "className", "gridStyle", "toolbarVisibility", "pagination", "sorting", "inMemory", "onColumnResize", "minSizeForControls", "height", "width", "rowHeightsOptions", "virtualizationOptions", "renderCustomGridBody", "renderCustomToolbar"],
29
- _excluded2 = ["focusProps"];
28
+ var _excluded = ["leadingControlColumns", "trailingControlColumns", "columns", "columnVisibility", "schemaDetectors", "rowCount", "renderCellValue", "cellContext", "renderCellPopover", "renderFooterCellValue", "className", "gridStyle", "toolbarVisibility", "pagination", "sorting", "inMemory", "onColumnResize", "minSizeForControls", "height", "width", "rowHeightsOptions", "virtualizationOptions", "renderCustomGridBody", "renderCustomToolbar"];
30
29
  /*
31
30
  * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
32
31
  * or more contributor license agreements. Licensed under the Elastic License
@@ -84,8 +83,8 @@ var cellPaddingsToClassMap = {
84
83
  m: '',
85
84
  l: 'euiDataGrid--paddingLarge'
86
85
  };
86
+ var emptyVirtualizationOptions = {};
87
87
  var EuiDataGrid = /*#__PURE__*/(0, _react.memo)( /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
88
- var _gridItemsRendered$cu;
89
88
  var _props$leadingControl = props.leadingControlColumns,
90
89
  leadingControlColumns = _props$leadingControl === void 0 ? _data_grid_types.emptyControlColumns : _props$leadingControl,
91
90
  _props$trailingContro = props.trailingControlColumns,
@@ -205,8 +204,14 @@ var EuiDataGrid = /*#__PURE__*/(0, _react.memo)( /*#__PURE__*/(0, _react.forward
205
204
  /**
206
205
  * Sorting
207
206
  */
208
- var columnSorting = (0, _controls.useDataGridColumnSorting)(orderedVisibleColumns, sorting, mergedSchema, allSchemaDetectors, displayValues);
209
- var sortingContext = (0, _sorting.useSorting)({
207
+ var columnSorting = (0, _controls.useDataGridColumnSorting)({
208
+ sorting: sorting,
209
+ columns: orderedVisibleColumns,
210
+ displayValues: displayValues,
211
+ schema: mergedSchema,
212
+ schemaDetectors: allSchemaDetectors
213
+ });
214
+ var sortedContext = (0, _sorting.useSorting)({
210
215
  sorting: sorting,
211
216
  inMemory: inMemory,
212
217
  inMemoryValues: inMemoryValues,
@@ -220,7 +225,20 @@ var EuiDataGrid = /*#__PURE__*/(0, _react.memo)( /*#__PURE__*/(0, _react.forward
220
225
  */
221
226
  var _useFocus = (0, _focus.useFocus)(),
222
227
  wrappingDivFocusProps = _useFocus.focusProps,
223
- focusContext = _objectWithoutProperties(_useFocus, _excluded2);
228
+ onFocusUpdate = _useFocus.onFocusUpdate,
229
+ focusedCell = _useFocus.focusedCell,
230
+ setFocusedCell = _useFocus.setFocusedCell,
231
+ setIsFocusedCellInView = _useFocus.setIsFocusedCellInView,
232
+ focusFirstVisibleInteractiveCell = _useFocus.focusFirstVisibleInteractiveCell;
233
+ var focusContext = (0, _react.useMemo)(function () {
234
+ return {
235
+ onFocusUpdate: onFocusUpdate,
236
+ focusedCell: focusedCell,
237
+ setFocusedCell: setFocusedCell,
238
+ setIsFocusedCellInView: setIsFocusedCellInView,
239
+ focusFirstVisibleInteractiveCell: focusFirstVisibleInteractiveCell
240
+ };
241
+ }, [onFocusUpdate, focusedCell, setFocusedCell, setIsFocusedCellInView, focusFirstVisibleInteractiveCell]);
224
242
 
225
243
  /**
226
244
  * Cell popover
@@ -250,7 +268,7 @@ var EuiDataGrid = /*#__PURE__*/(0, _react.memo)( /*#__PURE__*/(0, _react.forward
250
268
  setIsFullScreen: setIsFullScreen,
251
269
  focusContext: focusContext,
252
270
  cellPopoverContext: cellPopoverContext,
253
- sortingContext: sortingContext,
271
+ sortedContext: sortedContext,
254
272
  pagination: pagination,
255
273
  rowCount: rowCount,
256
274
  visibleColCount: visibleColCount
@@ -297,12 +315,25 @@ var EuiDataGrid = /*#__PURE__*/(0, _react.memo)( /*#__PURE__*/(0, _react.forward
297
315
  gridAriaProps['aria-labelledby'] = "".concat(rest['aria-labelledby'], " ").concat(pagination ? ariaLabelledById : '');
298
316
  delete rest['aria-labelledby'];
299
317
  }
318
+ var onKeyDown = (0, _react.useCallback)(function (event) {
319
+ var _gridItemsRendered$cu;
320
+ (0, _focus.createKeyDownHandler)({
321
+ gridElement: contentRef.current,
322
+ visibleColCount: visibleColCount,
323
+ visibleRowCount: visibleRowCount,
324
+ visibleRowStartIndex: ((_gridItemsRendered$cu = gridItemsRendered.current) === null || _gridItemsRendered$cu === void 0 ? void 0 : _gridItemsRendered$cu.visibleRowStartIndex) || 0,
325
+ rowCount: rowCount,
326
+ pagination: pagination,
327
+ hasFooter: !!renderFooterCellValue,
328
+ focusContext: focusContext
329
+ })(event);
330
+ }, [focusContext, visibleColCount, visibleRowCount, rowCount, pagination, renderFooterCellValue]);
300
331
  return (0, _react2.jsx)(_focus.DataGridFocusContext.Provider, {
301
332
  value: focusContext
302
333
  }, (0, _react2.jsx)(_cell.DataGridCellPopoverContext.Provider, {
303
334
  value: cellPopoverContext
304
- }, (0, _react2.jsx)(_sorting.DataGridSortingContext.Provider, {
305
- value: sortingContext
335
+ }, (0, _react2.jsx)(_sorting.DataGridSortedContext.Provider, {
336
+ value: sortedContext
306
337
  }, (0, _react2.jsx)(_focus_trap.EuiFocusTrap, {
307
338
  disabled: !isFullScreen,
308
339
  className: "euiDataGrid__focusWrap"
@@ -338,16 +369,7 @@ var EuiDataGrid = /*#__PURE__*/(0, _react.memo)( /*#__PURE__*/(0, _react.forward
338
369
  }) : null, (0, _react2.jsx)("div", _extends({
339
370
  // eslint-disable-line jsx-a11y/interactive-supports-focus
340
371
  ref: contentRef,
341
- onKeyDown: (0, _focus.createKeyDownHandler)({
342
- gridElement: contentRef.current,
343
- visibleColCount: visibleColCount,
344
- visibleRowCount: visibleRowCount,
345
- visibleRowStartIndex: ((_gridItemsRendered$cu = gridItemsRendered.current) === null || _gridItemsRendered$cu === void 0 ? void 0 : _gridItemsRendered$cu.visibleRowStartIndex) || 0,
346
- rowCount: rowCount,
347
- pagination: pagination,
348
- hasFooter: !!renderFooterCellValue,
349
- focusContext: focusContext
350
- }),
372
+ onKeyDown: onKeyDown,
351
373
  "data-test-subj": "euiDataGridBody",
352
374
  className: "euiDataGrid__content",
353
375
  role: "grid",
@@ -363,6 +385,7 @@ var EuiDataGrid = /*#__PURE__*/(0, _react.memo)( /*#__PURE__*/(0, _react.forward
363
385
  switchColumnPos: switchColumnPos,
364
386
  onColumnResize: onColumnResize,
365
387
  schemaDetectors: allSchemaDetectors,
388
+ sorting: sorting,
366
389
  pagination: pagination,
367
390
  renderCellValue: renderCellValue,
368
391
  cellContext: cellContext,
@@ -372,7 +395,7 @@ var EuiDataGrid = /*#__PURE__*/(0, _react.memo)( /*#__PURE__*/(0, _react.forward
372
395
  visibleRows: visibleRows,
373
396
  interactiveCellId: interactiveCellId,
374
397
  rowHeightsOptions: rowHeightsOptions,
375
- virtualizationOptions: virtualizationOptions || {},
398
+ virtualizationOptions: virtualizationOptions || emptyVirtualizationOptions,
376
399
  isFullScreen: isFullScreen,
377
400
  gridStyles: gridStyles,
378
401
  gridWidth: gridWidth,
@@ -8,15 +8,15 @@ exports.useDefaultColumnWidth = exports.useColumnWidths = exports.doesColumnHave
8
8
  var _react = require("react");
9
9
  var _services = require("../../../services");
10
10
  var _utils = require("../../../utils");
11
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
12
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
13
+ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
14
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
11
15
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
12
16
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
13
17
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
14
18
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
15
19
  function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
16
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
17
- function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
18
- function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
19
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
20
20
  function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
21
21
  function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
22
22
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
@@ -65,10 +65,12 @@ var useColumnWidths = function useColumnWidths(_ref) {
65
65
  onColumnResize = _ref.onColumnResize;
66
66
  var computeColumnWidths = (0, _react.useCallback)(function () {
67
67
  return columns.filter(doesColumnHaveAnInitialWidth).reduce(function (initialWidths, column) {
68
- initialWidths[column.id] = column.initialWidth;
69
- return initialWidths;
68
+ return _objectSpread(_objectSpread({}, initialWidths), {}, _defineProperty({}, column.id, column.initialWidth));
70
69
  }, {});
71
70
  }, [columns]);
71
+
72
+ // Passes initializer function for performance, so computing only runs once on init
73
+ // @see https://react.dev/reference/react/useState#examples-initializer
72
74
  var _useState = (0, _react.useState)(computeColumnWidths),
73
75
  _useState2 = _slicedToArray(_useState, 2),
74
76
  columnWidths = _useState2[0],
@@ -77,14 +79,16 @@ var useColumnWidths = function useColumnWidths(_ref) {
77
79
  setColumnWidths(computeColumnWidths());
78
80
  }, [computeColumnWidths]);
79
81
  var setColumnWidth = (0, _react.useCallback)(function (columnId, width) {
80
- setColumnWidths(_objectSpread(_objectSpread({}, columnWidths), {}, _defineProperty({}, columnId, width)));
82
+ setColumnWidths(function (prevColumnWidths) {
83
+ return _objectSpread(_objectSpread({}, prevColumnWidths), {}, _defineProperty({}, columnId, width));
84
+ });
81
85
  if (onColumnResize) {
82
86
  onColumnResize({
83
87
  columnId: columnId,
84
88
  width: width
85
89
  });
86
90
  }
87
- }, [columnWidths, onColumnResize]);
91
+ }, [onColumnResize]);
88
92
 
89
93
  // Used by react-window to determine actual column widths
90
94
  var getColumnWidth = (0, _react.useCallback)(function (index) {
@@ -97,14 +97,16 @@ var useFocus = function useFocus() {
97
97
  }
98
98
  };
99
99
  }, [isFocusedCellInView, focusFirstVisibleInteractiveCell]);
100
- return {
101
- onFocusUpdate: onFocusUpdate,
102
- focusedCell: focusedCell,
103
- setFocusedCell: setFocusedCell,
104
- setIsFocusedCellInView: setIsFocusedCellInView,
105
- focusFirstVisibleInteractiveCell: focusFirstVisibleInteractiveCell,
106
- focusProps: focusProps
107
- };
100
+ return (0, _react.useMemo)(function () {
101
+ return {
102
+ onFocusUpdate: onFocusUpdate,
103
+ focusedCell: focusedCell,
104
+ setFocusedCell: setFocusedCell,
105
+ setIsFocusedCellInView: setIsFocusedCellInView,
106
+ focusFirstVisibleInteractiveCell: focusFirstVisibleInteractiveCell,
107
+ focusProps: focusProps
108
+ };
109
+ }, [onFocusUpdate, focusedCell, setFocusedCell, setIsFocusedCellInView, focusFirstVisibleInteractiveCell, focusProps]);
108
110
  };
109
111
  exports.useFocus = useFocus;
110
112
  var notifyCellOfFocusState = function notifyCellOfFocusState(cellsUpdateFocus, cell, isFocused) {
@@ -93,42 +93,43 @@ var useUnconstrainedHeight = function useUnconstrainedHeight(_ref2) {
93
93
  footerRowHeight = _ref2.footerRowHeight,
94
94
  scrollBarHeight = _ref2.scrollBarHeight,
95
95
  innerGridRef = _ref2.innerGridRef;
96
- var _useContext = (0, _react.useContext)(_sorting.DataGridSortingContext),
96
+ var _useContext = (0, _react.useContext)(_sorting.DataGridSortedContext),
97
97
  getCorrectRowIndex = _useContext.getCorrectRowIndex;
98
- var knownHeight = 0; // tracks the pixel height of rows we know the size of
99
- var knownRowCount = 0; // how many rows we know the size of
100
- for (var i = startRow; i < endRow; i++) {
101
- var correctRowIndex = getCorrectRowIndex(i); // map visible row to logical row
102
-
103
- // lookup the height configuration of this row
104
- var rowHeightOption = rowHeightUtils.getRowHeightOption(correctRowIndex, rowHeightsOptions);
105
- if (rowHeightOption) {
106
- // this row's height is known
107
- knownRowCount++;
108
- knownHeight += rowHeightUtils.getCalculatedHeight(rowHeightOption, defaultRowHeight, correctRowIndex, rowHeightUtils.isRowHeightOverride(correctRowIndex, rowHeightsOptions));
109
- }
110
- }
111
-
112
- // how many rows to provide space for on the screen
113
- var rowCountToAffordFor = endRow - startRow;
114
-
115
98
  // watch the inner element for a change to its width
116
99
  // which may cause the horizontal scrollbar to be added or removed
117
100
  var _useResizeObserver = (0, _resize_observer.useResizeObserver)(innerGridRef.current, 'width'),
118
101
  innerWidth = _useResizeObserver.width;
119
102
  var forceRender = (0, _services.useForceRender)();
120
103
  (0, _services.useUpdateEffect)(forceRender, [innerWidth]);
121
- var unconstrainedHeight = defaultRowHeight * (rowCountToAffordFor - knownRowCount) +
122
- // guess how much space is required for unknown rows
123
- knownHeight +
124
- // computed pixel height of the known rows
125
- headerRowHeight +
126
- // account for header
127
- footerRowHeight +
128
- // account for footer
129
- scrollBarHeight; // account for horizontal scrollbar
104
+ return (0, _react.useMemo)(function () {
105
+ var knownHeight = 0; // tracks the pixel height of rows we know the size of
106
+ var knownRowCount = 0; // how many rows we know the size of
107
+ for (var i = startRow; i < endRow; i++) {
108
+ var correctRowIndex = getCorrectRowIndex(i); // map visible row to logical row
109
+
110
+ // lookup the height configuration of this row
111
+ var rowHeightOption = rowHeightUtils.getRowHeightOption(correctRowIndex, rowHeightsOptions);
112
+ if (rowHeightOption) {
113
+ // this row's height is known
114
+ knownRowCount++;
115
+ knownHeight += rowHeightUtils.getCalculatedHeight(rowHeightOption, defaultRowHeight, correctRowIndex, rowHeightUtils.isRowHeightOverride(correctRowIndex, rowHeightsOptions));
116
+ }
117
+ }
118
+
119
+ // how many rows to provide space for on the screen
120
+ var rowCountToAffordFor = endRow - startRow;
121
+ var unconstrainedHeight = defaultRowHeight * (rowCountToAffordFor - knownRowCount) +
122
+ // guess how much space is required for unknown rows
123
+ knownHeight +
124
+ // computed pixel height of the known rows
125
+ headerRowHeight +
126
+ // account for header
127
+ footerRowHeight +
128
+ // account for footer
129
+ scrollBarHeight; // account for horizontal scrollbar
130
130
 
131
- return unconstrainedHeight;
131
+ return unconstrainedHeight;
132
+ }, [defaultRowHeight, endRow, footerRowHeight, headerRowHeight, startRow, getCorrectRowIndex, rowHeightUtils, rowHeightsOptions, scrollBarHeight]);
132
133
  };
133
134
 
134
135
  /**