@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,6 +1,7 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ var _typeof = require("@babel/runtime/helpers/typeof");
4
5
  Object.defineProperty(exports, "__esModule", {
5
6
  value: true
6
7
  });
@@ -8,7 +9,7 @@ exports.defaultSortDescLabel = exports.defaultSortAscLabel = exports.EuiDataGrid
8
9
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
9
10
  var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
10
11
  var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
11
- var _react = _interopRequireDefault(require("react"));
12
+ var _react = _interopRequireWildcard(require("react"));
12
13
  var _propTypes = _interopRequireDefault(require("prop-types"));
13
14
  var _classnames = _interopRequireDefault(require("classnames"));
14
15
  var _accessibility = require("../../accessibility");
@@ -29,6 +30,8 @@ var _excluded = ["id", "display", "direction", "index", "sorting", "schema", "sc
29
30
  * in compliance with, at your election, the Elastic License 2.0 or the Server
30
31
  * Side Public License, v 1.
31
32
  */
33
+ 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); }
34
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
32
35
  var defaultSortAscLabel = (0, _react2.jsx)(_i18n.EuiI18n, {
33
36
  token: "euiColumnSortingDraggable.defaultSortAsc",
34
37
  default: "A-Z"
@@ -63,6 +66,27 @@ var EuiDataGridColumnSortingDraggable = function EuiDataGridColumnSortingDraggab
63
66
  'data-test-subj': "euiDataGridColumnSorting-sortColumn-".concat(id, "-desc")
64
67
  }];
65
68
  var dragHandleAriaLabel = (0, _i18n.useEuiI18n)('euiColumnSortingDraggable.dragHandleAriaLabel', 'Drag handle');
69
+ var removeSort = (0, _react.useCallback)(function () {
70
+ var nextColumns = (0, _toConsumableArray2.default)(sorting.columns);
71
+ var columnIndex = nextColumns.map(function (_ref2) {
72
+ var id = _ref2.id;
73
+ return id;
74
+ }).indexOf(id);
75
+ nextColumns.splice(columnIndex, 1);
76
+ sorting.onSort(nextColumns);
77
+ }, [id, sorting]);
78
+ var toggleLegendHandler = (0, _react.useCallback)(function (_, direction) {
79
+ var nextColumns = (0, _toConsumableArray2.default)(sorting.columns);
80
+ var columnIndex = nextColumns.map(function (_ref3) {
81
+ var id = _ref3.id;
82
+ return id;
83
+ }).indexOf(id);
84
+ nextColumns.splice(columnIndex, 1, {
85
+ id: id,
86
+ direction: direction
87
+ });
88
+ sorting.onSort(nextColumns);
89
+ }, [id, sorting]);
66
90
  return (0, _react2.jsx)(_drag_and_drop.EuiDraggable, (0, _extends2.default)({
67
91
  draggableId: id,
68
92
  index: index,
@@ -100,15 +124,7 @@ var EuiDataGridColumnSortingDraggable = function EuiDataGridColumnSortingDraggab
100
124
  className: "euiDataGridColumnSorting__button",
101
125
  "aria-label": removeSortLabel,
102
126
  iconType: "cross",
103
- onClick: function onClick() {
104
- var nextColumns = (0, _toConsumableArray2.default)(sorting.columns);
105
- var columnIndex = nextColumns.map(function (_ref2) {
106
- var id = _ref2.id;
107
- return id;
108
- }).indexOf(id);
109
- nextColumns.splice(columnIndex, 1);
110
- sorting.onSort(nextColumns);
111
- }
127
+ onClick: removeSort
112
128
  });
113
129
  })), (0, _react2.jsx)(_flex.EuiFlexItem, (0, _extends2.default)({
114
130
  className: "euiDataGridColumnSorting__name"
@@ -143,18 +159,7 @@ var EuiDataGridColumnSortingDraggable = function EuiDataGridColumnSortingDraggab
143
159
  buttonSize: "compressed",
144
160
  className: "euiDataGridColumnSorting__order",
145
161
  idSelected: direction === 'asc' ? "".concat(id, "Asc") : "".concat(id, "Desc"),
146
- onChange: function onChange(_, direction) {
147
- var nextColumns = (0, _toConsumableArray2.default)(sorting.columns);
148
- var columnIndex = nextColumns.map(function (_ref3) {
149
- var id = _ref3.id;
150
- return id;
151
- }).indexOf(id);
152
- nextColumns.splice(columnIndex, 1, {
153
- id: id,
154
- direction: direction
155
- });
156
- sorting.onSort(nextColumns);
157
- }
162
+ onChange: toggleLegendHandler
158
163
  });
159
164
  })), (0, _react2.jsx)(_flex.EuiFlexItem, (0, _extends2.default)({
160
165
  grow: false
@@ -204,114 +204,116 @@ var useDataGridDisplaySelector = function useDataGridDisplaySelector(showDisplay
204
204
  }, []);
205
205
  var buttonLabel = (0, _i18n.useEuiI18n)('euiDisplaySelector.buttonText', 'Display options');
206
206
  var resetButtonLabel = (0, _i18n.useEuiI18n)('euiDisplaySelector.resetButtonText', 'Reset to default');
207
- var displaySelector = showDensityControls || showRowHeightControls || additionalDisplaySettings ? (0, _react2.jsx)(_popover.EuiPopover, {
208
- "data-test-subj": "dataGridDisplaySelectorPopover",
209
- isOpen: isOpen,
210
- closePopover: function closePopover() {
211
- return setIsOpen(false);
212
- },
213
- anchorPosition: "downRight",
214
- panelPaddingSize: "s",
215
- panelClassName: "euiDataGrid__displayPopoverPanel",
216
- button: (0, _react2.jsx)(_tool_tip.EuiToolTip, {
217
- content: buttonLabel,
218
- delay: "long"
219
- }, (0, _react2.jsx)(_button.EuiButtonIcon, {
220
- size: "xs",
221
- iconType: "controlsHorizontal",
222
- color: "text",
223
- "data-test-subj": "dataGridDisplaySelectorButton",
224
- onClick: function onClick() {
225
- return setIsOpen(!isOpen);
207
+ var displaySelector = (0, _react.useMemo)(function () {
208
+ return showDensityControls || showRowHeightControls || additionalDisplaySettings ? (0, _react2.jsx)(_popover.EuiPopover, {
209
+ "data-test-subj": "dataGridDisplaySelectorPopover",
210
+ isOpen: isOpen,
211
+ closePopover: function closePopover() {
212
+ return setIsOpen(false);
226
213
  },
227
- "aria-label": buttonLabel
228
- }))
229
- }, showDensityControls && (0, _react2.jsx)(_i18n.EuiI18n, {
230
- tokens: ['euiDisplaySelector.densityLabel', 'euiDisplaySelector.labelCompact', 'euiDisplaySelector.labelNormal', 'euiDisplaySelector.labelExpanded'],
231
- defaults: ['Density', 'Compact', 'Normal', 'Expanded']
232
- }, function (_ref) {
233
- var _ref2 = (0, _slicedToArray2.default)(_ref, 4),
234
- densityLabel = _ref2[0],
235
- labelCompact = _ref2[1],
236
- labelNormal = _ref2[2],
237
- labelExpanded = _ref2[3];
238
- return (0, _react2.jsx)(_form.EuiFormRow, {
239
- label: densityLabel,
240
- display: "columnCompressed"
241
- }, (0, _react2.jsx)(_button.EuiButtonGroup, {
242
- legend: densityLabel,
243
- buttonSize: "compressed",
244
- isFullWidth: true,
245
- options: [{
246
- id: densityOptions[0],
247
- label: labelCompact
248
- }, {
249
- id: densityOptions[1],
250
- label: labelNormal
251
- }, {
252
- id: densityOptions[2],
253
- label: labelExpanded
254
- }],
255
- onChange: setGridStyles,
256
- idSelected: gridDensity,
257
- "data-test-subj": "densityButtonGroup"
258
- }));
259
- }), showRowHeightControls && (0, _react2.jsx)(_i18n.EuiI18n, {
260
- tokens: ['euiDisplaySelector.rowHeightLabel', 'euiDisplaySelector.labelSingle', 'euiDisplaySelector.labelAuto', 'euiDisplaySelector.labelCustom', 'euiDisplaySelector.lineCountLabel'],
261
- defaults: ['Row height', 'Single', 'Auto fit', 'Custom', 'Lines per row']
262
- }, function (_ref3) {
263
- var _ref4 = (0, _slicedToArray2.default)(_ref3, 5),
264
- rowHeightLabel = _ref4[0],
265
- labelSingle = _ref4[1],
266
- labelAuto = _ref4[2],
267
- labelCustom = _ref4[3],
268
- lineCountLabel = _ref4[4];
269
- return (0, _react2.jsx)(_react.default.Fragment, null, (0, _react2.jsx)(_form.EuiFormRow, {
270
- label: rowHeightLabel,
271
- display: "columnCompressed"
272
- }, (0, _react2.jsx)(_button.EuiButtonGroup, {
273
- legend: rowHeightLabel,
274
- buttonSize: "compressed",
275
- isFullWidth: true,
276
- options: [{
277
- id: rowHeightButtonOptions[0],
278
- label: labelSingle
279
- }, {
280
- id: rowHeightButtonOptions[1],
281
- label: labelAuto
282
- }, {
283
- id: rowHeightButtonOptions[2],
284
- label: labelCustom
285
- }],
286
- onChange: setRowHeight,
287
- idSelected: rowHeightSelection,
288
- "data-test-subj": "rowHeightButtonGroup"
289
- })), rowHeightSelection === rowHeightButtonOptions[2] && (0, _react2.jsx)(_form.EuiFormRow, {
290
- label: lineCountLabel,
291
- display: "columnCompressed"
292
- }, (0, _react2.jsx)(_form.EuiRange, {
293
- compressed: true,
294
- fullWidth: true,
295
- showInput: true,
296
- min: 1,
297
- max: 20,
298
- step: 1,
299
- required: true,
300
- value: lineCountInput,
301
- onChange: setLineCountHeight,
302
- "data-test-subj": "lineCountNumber"
303
- })));
304
- }), additionalDisplaySettings, showResetButton && (0, _react2.jsx)(_popover.EuiPopoverFooter, null, (0, _react2.jsx)(_flex.EuiFlexGroup, {
305
- justifyContent: "flexEnd",
306
- responsive: false
307
- }, (0, _react2.jsx)(_flex.EuiFlexItem, {
308
- grow: false
309
- }, (0, _react2.jsx)("div", null, (0, _react2.jsx)(_button.EuiButtonEmpty, {
310
- flush: "both",
311
- size: "xs",
312
- onClick: resetToInitialState,
313
- "data-test-subj": "resetDisplaySelector"
314
- }, resetButtonLabel)))))) : null;
214
+ anchorPosition: "downRight",
215
+ panelPaddingSize: "s",
216
+ panelClassName: "euiDataGrid__displayPopoverPanel",
217
+ button: (0, _react2.jsx)(_tool_tip.EuiToolTip, {
218
+ content: buttonLabel,
219
+ delay: "long"
220
+ }, (0, _react2.jsx)(_button.EuiButtonIcon, {
221
+ size: "xs",
222
+ iconType: "controlsHorizontal",
223
+ color: "text",
224
+ "data-test-subj": "dataGridDisplaySelectorButton",
225
+ onClick: function onClick() {
226
+ return setIsOpen(!isOpen);
227
+ },
228
+ "aria-label": buttonLabel
229
+ }))
230
+ }, showDensityControls && (0, _react2.jsx)(_i18n.EuiI18n, {
231
+ tokens: ['euiDisplaySelector.densityLabel', 'euiDisplaySelector.labelCompact', 'euiDisplaySelector.labelNormal', 'euiDisplaySelector.labelExpanded'],
232
+ defaults: ['Density', 'Compact', 'Normal', 'Expanded']
233
+ }, function (_ref) {
234
+ var _ref2 = (0, _slicedToArray2.default)(_ref, 4),
235
+ densityLabel = _ref2[0],
236
+ labelCompact = _ref2[1],
237
+ labelNormal = _ref2[2],
238
+ labelExpanded = _ref2[3];
239
+ return (0, _react2.jsx)(_form.EuiFormRow, {
240
+ label: densityLabel,
241
+ display: "columnCompressed"
242
+ }, (0, _react2.jsx)(_button.EuiButtonGroup, {
243
+ legend: densityLabel,
244
+ buttonSize: "compressed",
245
+ isFullWidth: true,
246
+ options: [{
247
+ id: densityOptions[0],
248
+ label: labelCompact
249
+ }, {
250
+ id: densityOptions[1],
251
+ label: labelNormal
252
+ }, {
253
+ id: densityOptions[2],
254
+ label: labelExpanded
255
+ }],
256
+ onChange: setGridStyles,
257
+ idSelected: gridDensity,
258
+ "data-test-subj": "densityButtonGroup"
259
+ }));
260
+ }), showRowHeightControls && (0, _react2.jsx)(_i18n.EuiI18n, {
261
+ tokens: ['euiDisplaySelector.rowHeightLabel', 'euiDisplaySelector.labelSingle', 'euiDisplaySelector.labelAuto', 'euiDisplaySelector.labelCustom', 'euiDisplaySelector.lineCountLabel'],
262
+ defaults: ['Row height', 'Single', 'Auto fit', 'Custom', 'Lines per row']
263
+ }, function (_ref3) {
264
+ var _ref4 = (0, _slicedToArray2.default)(_ref3, 5),
265
+ rowHeightLabel = _ref4[0],
266
+ labelSingle = _ref4[1],
267
+ labelAuto = _ref4[2],
268
+ labelCustom = _ref4[3],
269
+ lineCountLabel = _ref4[4];
270
+ return (0, _react2.jsx)(_react.default.Fragment, null, (0, _react2.jsx)(_form.EuiFormRow, {
271
+ label: rowHeightLabel,
272
+ display: "columnCompressed"
273
+ }, (0, _react2.jsx)(_button.EuiButtonGroup, {
274
+ legend: rowHeightLabel,
275
+ buttonSize: "compressed",
276
+ isFullWidth: true,
277
+ options: [{
278
+ id: rowHeightButtonOptions[0],
279
+ label: labelSingle
280
+ }, {
281
+ id: rowHeightButtonOptions[1],
282
+ label: labelAuto
283
+ }, {
284
+ id: rowHeightButtonOptions[2],
285
+ label: labelCustom
286
+ }],
287
+ onChange: setRowHeight,
288
+ idSelected: rowHeightSelection,
289
+ "data-test-subj": "rowHeightButtonGroup"
290
+ })), rowHeightSelection === rowHeightButtonOptions[2] && (0, _react2.jsx)(_form.EuiFormRow, {
291
+ label: lineCountLabel,
292
+ display: "columnCompressed"
293
+ }, (0, _react2.jsx)(_form.EuiRange, {
294
+ compressed: true,
295
+ fullWidth: true,
296
+ showInput: true,
297
+ min: 1,
298
+ max: 20,
299
+ step: 1,
300
+ required: true,
301
+ value: lineCountInput,
302
+ onChange: setLineCountHeight,
303
+ "data-test-subj": "lineCountNumber"
304
+ })));
305
+ }), additionalDisplaySettings, showResetButton && (0, _react2.jsx)(_popover.EuiPopoverFooter, null, (0, _react2.jsx)(_flex.EuiFlexGroup, {
306
+ justifyContent: "flexEnd",
307
+ responsive: false
308
+ }, (0, _react2.jsx)(_flex.EuiFlexItem, {
309
+ grow: false
310
+ }, (0, _react2.jsx)("div", null, (0, _react2.jsx)(_button.EuiButtonEmpty, {
311
+ flush: "both",
312
+ size: "xs",
313
+ onClick: resetToInitialState,
314
+ "data-test-subj": "resetDisplaySelector"
315
+ }, resetButtonLabel)))))) : null;
316
+ }, [additionalDisplaySettings, buttonLabel, isOpen, resetButtonLabel, showDensityControls, showResetButton, showRowHeightControls, gridDensity, rowHeightSelection, lineCountInput, setGridStyles, setRowHeight, setLineCountHeight, resetToInitialState]);
315
317
  return [displaySelector, gridStyles, rowHeightsOptions];
316
318
  };
317
319
  exports.useDataGridDisplaySelector = useDataGridDisplaySelector;
@@ -72,9 +72,19 @@ var commaSeparateNumbers = function commaSeparateNumbers(numberString) {
72
72
  );
73
73
  });
74
74
  };
75
+ var renderCellValue = function renderCellValue(_ref2) {
76
+ var rowIndex = _ref2.rowIndex,
77
+ columnId = _ref2.columnId,
78
+ schema = _ref2.schema;
79
+ var value = storeData[rowIndex][columnId];
80
+ if (schema === 'numeric') {
81
+ value = commaSeparateNumbers(value);
82
+ }
83
+ return value;
84
+ };
75
85
  var DataGrid = function DataGrid() {
76
- var _useState = (0, _react.useState)(columns.map(function (_ref2) {
77
- var id = _ref2.id;
86
+ var _useState = (0, _react.useState)(columns.map(function (_ref3) {
87
+ var id = _ref3.id;
78
88
  return id;
79
89
  })),
80
90
  _useState2 = (0, _slicedToArray2.default)(_useState, 2),
@@ -116,16 +126,7 @@ var DataGrid = function DataGrid() {
116
126
  inMemory: {
117
127
  level: 'sorting'
118
128
  },
119
- renderCellValue: function renderCellValue(_ref3) {
120
- var rowIndex = _ref3.rowIndex,
121
- columnId = _ref3.columnId,
122
- schema = _ref3.schema;
123
- var value = data[rowIndex][columnId];
124
- if (schema === 'numeric') {
125
- value = commaSeparateNumbers(value);
126
- }
127
- return value;
128
- },
129
+ renderCellValue: renderCellValue,
129
130
  sorting: {
130
131
  columns: sortingColumns,
131
132
  onSort: setSorting
@@ -31,8 +31,7 @@ var _data_grid_schema = require("./utils/data_grid_schema");
31
31
  var _ref = require("./utils/ref");
32
32
  var _data_grid_types = require("./data_grid_types");
33
33
  var _react2 = require("@emotion/react");
34
- 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"],
35
- _excluded2 = ["focusProps"];
34
+ 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"];
36
35
  /*
37
36
  * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
38
37
  * or more contributor license agreements. Licensed under the Elastic License
@@ -73,8 +72,8 @@ var cellPaddingsToClassMap = {
73
72
  m: '',
74
73
  l: 'euiDataGrid--paddingLarge'
75
74
  };
75
+ var emptyVirtualizationOptions = {};
76
76
  var EuiDataGrid = /*#__PURE__*/(0, _react.memo)( /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
77
- var _gridItemsRendered$cu;
78
77
  var _props$leadingControl = props.leadingControlColumns,
79
78
  leadingControlColumns = _props$leadingControl === void 0 ? _data_grid_types.emptyControlColumns : _props$leadingControl,
80
79
  _props$trailingContro = props.trailingControlColumns,
@@ -194,8 +193,14 @@ var EuiDataGrid = /*#__PURE__*/(0, _react.memo)( /*#__PURE__*/(0, _react.forward
194
193
  /**
195
194
  * Sorting
196
195
  */
197
- var columnSorting = (0, _controls.useDataGridColumnSorting)(orderedVisibleColumns, sorting, mergedSchema, allSchemaDetectors, displayValues);
198
- var sortingContext = (0, _sorting.useSorting)({
196
+ var columnSorting = (0, _controls.useDataGridColumnSorting)({
197
+ sorting: sorting,
198
+ columns: orderedVisibleColumns,
199
+ displayValues: displayValues,
200
+ schema: mergedSchema,
201
+ schemaDetectors: allSchemaDetectors
202
+ });
203
+ var sortedContext = (0, _sorting.useSorting)({
199
204
  sorting: sorting,
200
205
  inMemory: inMemory,
201
206
  inMemoryValues: inMemoryValues,
@@ -209,7 +214,20 @@ var EuiDataGrid = /*#__PURE__*/(0, _react.memo)( /*#__PURE__*/(0, _react.forward
209
214
  */
210
215
  var _useFocus = (0, _focus.useFocus)(),
211
216
  wrappingDivFocusProps = _useFocus.focusProps,
212
- focusContext = (0, _objectWithoutProperties2.default)(_useFocus, _excluded2);
217
+ onFocusUpdate = _useFocus.onFocusUpdate,
218
+ focusedCell = _useFocus.focusedCell,
219
+ setFocusedCell = _useFocus.setFocusedCell,
220
+ setIsFocusedCellInView = _useFocus.setIsFocusedCellInView,
221
+ focusFirstVisibleInteractiveCell = _useFocus.focusFirstVisibleInteractiveCell;
222
+ var focusContext = (0, _react.useMemo)(function () {
223
+ return {
224
+ onFocusUpdate: onFocusUpdate,
225
+ focusedCell: focusedCell,
226
+ setFocusedCell: setFocusedCell,
227
+ setIsFocusedCellInView: setIsFocusedCellInView,
228
+ focusFirstVisibleInteractiveCell: focusFirstVisibleInteractiveCell
229
+ };
230
+ }, [onFocusUpdate, focusedCell, setFocusedCell, setIsFocusedCellInView, focusFirstVisibleInteractiveCell]);
213
231
 
214
232
  /**
215
233
  * Cell popover
@@ -239,7 +257,7 @@ var EuiDataGrid = /*#__PURE__*/(0, _react.memo)( /*#__PURE__*/(0, _react.forward
239
257
  setIsFullScreen: setIsFullScreen,
240
258
  focusContext: focusContext,
241
259
  cellPopoverContext: cellPopoverContext,
242
- sortingContext: sortingContext,
260
+ sortedContext: sortedContext,
243
261
  pagination: pagination,
244
262
  rowCount: rowCount,
245
263
  visibleColCount: visibleColCount
@@ -286,12 +304,25 @@ var EuiDataGrid = /*#__PURE__*/(0, _react.memo)( /*#__PURE__*/(0, _react.forward
286
304
  gridAriaProps['aria-labelledby'] = "".concat(rest['aria-labelledby'], " ").concat(pagination ? ariaLabelledById : '');
287
305
  delete rest['aria-labelledby'];
288
306
  }
307
+ var onKeyDown = (0, _react.useCallback)(function (event) {
308
+ var _gridItemsRendered$cu;
309
+ (0, _focus.createKeyDownHandler)({
310
+ gridElement: contentRef.current,
311
+ visibleColCount: visibleColCount,
312
+ visibleRowCount: visibleRowCount,
313
+ visibleRowStartIndex: ((_gridItemsRendered$cu = gridItemsRendered.current) === null || _gridItemsRendered$cu === void 0 ? void 0 : _gridItemsRendered$cu.visibleRowStartIndex) || 0,
314
+ rowCount: rowCount,
315
+ pagination: pagination,
316
+ hasFooter: !!renderFooterCellValue,
317
+ focusContext: focusContext
318
+ })(event);
319
+ }, [focusContext, visibleColCount, visibleRowCount, rowCount, pagination, renderFooterCellValue]);
289
320
  return (0, _react2.jsx)(_focus.DataGridFocusContext.Provider, {
290
321
  value: focusContext
291
322
  }, (0, _react2.jsx)(_cell.DataGridCellPopoverContext.Provider, {
292
323
  value: cellPopoverContext
293
- }, (0, _react2.jsx)(_sorting.DataGridSortingContext.Provider, {
294
- value: sortingContext
324
+ }, (0, _react2.jsx)(_sorting.DataGridSortedContext.Provider, {
325
+ value: sortedContext
295
326
  }, (0, _react2.jsx)(_focus_trap.EuiFocusTrap, {
296
327
  disabled: !isFullScreen,
297
328
  className: "euiDataGrid__focusWrap"
@@ -327,16 +358,7 @@ var EuiDataGrid = /*#__PURE__*/(0, _react.memo)( /*#__PURE__*/(0, _react.forward
327
358
  }) : null, (0, _react2.jsx)("div", (0, _extends2.default)({
328
359
  // eslint-disable-line jsx-a11y/interactive-supports-focus
329
360
  ref: contentRef,
330
- onKeyDown: (0, _focus.createKeyDownHandler)({
331
- gridElement: contentRef.current,
332
- visibleColCount: visibleColCount,
333
- visibleRowCount: visibleRowCount,
334
- visibleRowStartIndex: ((_gridItemsRendered$cu = gridItemsRendered.current) === null || _gridItemsRendered$cu === void 0 ? void 0 : _gridItemsRendered$cu.visibleRowStartIndex) || 0,
335
- rowCount: rowCount,
336
- pagination: pagination,
337
- hasFooter: !!renderFooterCellValue,
338
- focusContext: focusContext
339
- }),
361
+ onKeyDown: onKeyDown,
340
362
  "data-test-subj": "euiDataGridBody",
341
363
  className: "euiDataGrid__content",
342
364
  role: "grid",
@@ -352,6 +374,7 @@ var EuiDataGrid = /*#__PURE__*/(0, _react.memo)( /*#__PURE__*/(0, _react.forward
352
374
  switchColumnPos: switchColumnPos,
353
375
  onColumnResize: onColumnResize,
354
376
  schemaDetectors: allSchemaDetectors,
377
+ sorting: sorting,
355
378
  pagination: pagination,
356
379
  renderCellValue: renderCellValue,
357
380
  cellContext: cellContext,
@@ -361,7 +384,7 @@ var EuiDataGrid = /*#__PURE__*/(0, _react.memo)( /*#__PURE__*/(0, _react.forward
361
384
  visibleRows: visibleRows,
362
385
  interactiveCellId: interactiveCellId,
363
386
  rowHeightsOptions: rowHeightsOptions,
364
- virtualizationOptions: virtualizationOptions || {},
387
+ virtualizationOptions: virtualizationOptions || emptyVirtualizationOptions,
365
388
  isFullScreen: isFullScreen,
366
389
  gridStyles: gridStyles,
367
390
  gridWidth: gridWidth,
@@ -5,8 +5,8 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.useDefaultColumnWidth = exports.useColumnWidths = exports.doesColumnHaveAnInitialWidth = void 0;
8
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
8
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
9
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
10
10
  var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
11
11
  var _react = require("react");
12
12
  var _services = require("../../../services");
@@ -55,10 +55,12 @@ var useColumnWidths = function useColumnWidths(_ref) {
55
55
  onColumnResize = _ref.onColumnResize;
56
56
  var computeColumnWidths = (0, _react.useCallback)(function () {
57
57
  return columns.filter(doesColumnHaveAnInitialWidth).reduce(function (initialWidths, column) {
58
- initialWidths[column.id] = column.initialWidth;
59
- return initialWidths;
58
+ return _objectSpread(_objectSpread({}, initialWidths), {}, (0, _defineProperty2.default)({}, column.id, column.initialWidth));
60
59
  }, {});
61
60
  }, [columns]);
61
+
62
+ // Passes initializer function for performance, so computing only runs once on init
63
+ // @see https://react.dev/reference/react/useState#examples-initializer
62
64
  var _useState = (0, _react.useState)(computeColumnWidths),
63
65
  _useState2 = (0, _slicedToArray2.default)(_useState, 2),
64
66
  columnWidths = _useState2[0],
@@ -67,14 +69,16 @@ var useColumnWidths = function useColumnWidths(_ref) {
67
69
  setColumnWidths(computeColumnWidths());
68
70
  }, [computeColumnWidths]);
69
71
  var setColumnWidth = (0, _react.useCallback)(function (columnId, width) {
70
- setColumnWidths(_objectSpread(_objectSpread({}, columnWidths), {}, (0, _defineProperty2.default)({}, columnId, width)));
72
+ setColumnWidths(function (prevColumnWidths) {
73
+ return _objectSpread(_objectSpread({}, prevColumnWidths), {}, (0, _defineProperty2.default)({}, columnId, width));
74
+ });
71
75
  if (onColumnResize) {
72
76
  onColumnResize({
73
77
  columnId: columnId,
74
78
  width: width
75
79
  });
76
80
  }
77
- }, [columnWidths, onColumnResize]);
81
+ }, [onColumnResize]);
78
82
 
79
83
  // Used by react-window to determine actual column widths
80
84
  var getColumnWidth = (0, _react.useCallback)(function (index) {
@@ -95,14 +95,16 @@ var useFocus = function useFocus() {
95
95
  }
96
96
  };
97
97
  }, [isFocusedCellInView, focusFirstVisibleInteractiveCell]);
98
- return {
99
- onFocusUpdate: onFocusUpdate,
100
- focusedCell: focusedCell,
101
- setFocusedCell: setFocusedCell,
102
- setIsFocusedCellInView: setIsFocusedCellInView,
103
- focusFirstVisibleInteractiveCell: focusFirstVisibleInteractiveCell,
104
- focusProps: focusProps
105
- };
98
+ return (0, _react.useMemo)(function () {
99
+ return {
100
+ onFocusUpdate: onFocusUpdate,
101
+ focusedCell: focusedCell,
102
+ setFocusedCell: setFocusedCell,
103
+ setIsFocusedCellInView: setIsFocusedCellInView,
104
+ focusFirstVisibleInteractiveCell: focusFirstVisibleInteractiveCell,
105
+ focusProps: focusProps
106
+ };
107
+ }, [onFocusUpdate, focusedCell, setFocusedCell, setIsFocusedCellInView, focusFirstVisibleInteractiveCell, focusProps]);
106
108
  };
107
109
  exports.useFocus = useFocus;
108
110
  var notifyCellOfFocusState = function notifyCellOfFocusState(cellsUpdateFocus, cell, isFocused) {
@@ -91,42 +91,43 @@ var useUnconstrainedHeight = function useUnconstrainedHeight(_ref2) {
91
91
  footerRowHeight = _ref2.footerRowHeight,
92
92
  scrollBarHeight = _ref2.scrollBarHeight,
93
93
  innerGridRef = _ref2.innerGridRef;
94
- var _useContext = (0, _react.useContext)(_sorting.DataGridSortingContext),
94
+ var _useContext = (0, _react.useContext)(_sorting.DataGridSortedContext),
95
95
  getCorrectRowIndex = _useContext.getCorrectRowIndex;
96
- var knownHeight = 0; // tracks the pixel height of rows we know the size of
97
- var knownRowCount = 0; // how many rows we know the size of
98
- for (var i = startRow; i < endRow; i++) {
99
- var correctRowIndex = getCorrectRowIndex(i); // map visible row to logical row
100
-
101
- // lookup the height configuration of this row
102
- var rowHeightOption = rowHeightUtils.getRowHeightOption(correctRowIndex, rowHeightsOptions);
103
- if (rowHeightOption) {
104
- // this row's height is known
105
- knownRowCount++;
106
- knownHeight += rowHeightUtils.getCalculatedHeight(rowHeightOption, defaultRowHeight, correctRowIndex, rowHeightUtils.isRowHeightOverride(correctRowIndex, rowHeightsOptions));
107
- }
108
- }
109
-
110
- // how many rows to provide space for on the screen
111
- var rowCountToAffordFor = endRow - startRow;
112
-
113
96
  // watch the inner element for a change to its width
114
97
  // which may cause the horizontal scrollbar to be added or removed
115
98
  var _useResizeObserver = (0, _resize_observer.useResizeObserver)(innerGridRef.current, 'width'),
116
99
  innerWidth = _useResizeObserver.width;
117
100
  var forceRender = (0, _services.useForceRender)();
118
101
  (0, _services.useUpdateEffect)(forceRender, [innerWidth]);
119
- var unconstrainedHeight = defaultRowHeight * (rowCountToAffordFor - knownRowCount) +
120
- // guess how much space is required for unknown rows
121
- knownHeight +
122
- // computed pixel height of the known rows
123
- headerRowHeight +
124
- // account for header
125
- footerRowHeight +
126
- // account for footer
127
- scrollBarHeight; // account for horizontal scrollbar
102
+ return (0, _react.useMemo)(function () {
103
+ var knownHeight = 0; // tracks the pixel height of rows we know the size of
104
+ var knownRowCount = 0; // how many rows we know the size of
105
+ for (var i = startRow; i < endRow; i++) {
106
+ var correctRowIndex = getCorrectRowIndex(i); // map visible row to logical row
107
+
108
+ // lookup the height configuration of this row
109
+ var rowHeightOption = rowHeightUtils.getRowHeightOption(correctRowIndex, rowHeightsOptions);
110
+ if (rowHeightOption) {
111
+ // this row's height is known
112
+ knownRowCount++;
113
+ knownHeight += rowHeightUtils.getCalculatedHeight(rowHeightOption, defaultRowHeight, correctRowIndex, rowHeightUtils.isRowHeightOverride(correctRowIndex, rowHeightsOptions));
114
+ }
115
+ }
116
+
117
+ // how many rows to provide space for on the screen
118
+ var rowCountToAffordFor = endRow - startRow;
119
+ var unconstrainedHeight = defaultRowHeight * (rowCountToAffordFor - knownRowCount) +
120
+ // guess how much space is required for unknown rows
121
+ knownHeight +
122
+ // computed pixel height of the known rows
123
+ headerRowHeight +
124
+ // account for header
125
+ footerRowHeight +
126
+ // account for footer
127
+ scrollBarHeight; // account for horizontal scrollbar
128
128
 
129
- return unconstrainedHeight;
129
+ return unconstrainedHeight;
130
+ }, [defaultRowHeight, endRow, footerRowHeight, headerRowHeight, startRow, getCorrectRowIndex, rowHeightUtils, rowHeightsOptions, scrollBarHeight]);
130
131
  };
131
132
 
132
133
  /**
@@ -19,7 +19,7 @@ var useImperativeGridRef = function useImperativeGridRef(_ref) {
19
19
  setIsFullScreen = _ref.setIsFullScreen,
20
20
  focusContext = _ref.focusContext,
21
21
  cellPopoverContext = _ref.cellPopoverContext,
22
- sortedRowMap = _ref.sortingContext.sortedRowMap,
22
+ sortedRowMap = _ref.sortedContext.sortedRowMap,
23
23
  pagination = _ref.pagination,
24
24
  rowCount = _ref.rowCount,
25
25
  visibleColCount = _ref.visibleColCount;
@@ -333,7 +333,7 @@ exports.useRowHeightUtils = useRowHeightUtils;
333
333
  var useDefaultRowHeight = function useDefaultRowHeight(_ref3) {
334
334
  var rowHeightsOptions = _ref3.rowHeightsOptions,
335
335
  rowHeightUtils = _ref3.rowHeightUtils;
336
- var _useContext = (0, _react.useContext)(_sorting.DataGridSortingContext),
336
+ var _useContext = (0, _react.useContext)(_sorting.DataGridSortedContext),
337
337
  getCorrectRowIndex = _useContext.getCorrectRowIndex;
338
338
 
339
339
  // `minRowHeight` is primarily used by undefined & lineCount heights