@elastic/eui 97.0.0 → 97.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (161) hide show
  1. package/es/components/datagrid/body/cell/data_grid_cell.styles.js +4 -2
  2. package/es/components/datagrid/body/cell/focus_utils.js +14 -4
  3. package/es/components/datagrid/body/data_grid_body.js +2 -1
  4. package/es/components/datagrid/body/data_grid_body_custom.js +5 -2
  5. package/es/components/datagrid/body/data_grid_body_virtualized.js +8 -4
  6. package/es/components/datagrid/body/header/column_actions.js +262 -27
  7. package/es/components/datagrid/body/header/{data_grid_column_resizer.js → column_resizer.js} +10 -4
  8. package/es/components/datagrid/body/header/{data_grid_column_resizer.styles.js → column_resizer.styles.js} +6 -1
  9. package/es/components/datagrid/body/header/column_sorting.js +134 -0
  10. package/es/components/datagrid/body/header/data_grid_control_header_cell.js +3 -3
  11. package/es/components/datagrid/body/header/data_grid_header_cell.js +86 -305
  12. package/es/components/datagrid/body/header/data_grid_header_cell.styles.js +1 -1
  13. package/es/components/datagrid/body/header/data_grid_header_cell_wrapper.js +19 -17
  14. package/es/components/datagrid/body/header/data_grid_header_cell_wrapper.styles.js +1 -2
  15. package/es/components/datagrid/body/header/data_grid_header_row.js +25 -10
  16. package/es/components/datagrid/body/header/draggable_columns.js +301 -0
  17. package/es/components/datagrid/body/header/draggable_columns.styles.js +38 -0
  18. package/es/components/datagrid/data_grid.js +2 -1
  19. package/es/components/datagrid/data_grid.stories.utils.js +9 -6
  20. package/es/components/datagrid/utils/col_widths.js +4 -6
  21. package/es/components/datagrid/utils/focus.js +2 -2
  22. package/es/components/datagrid/utils/scrolling.js +13 -10
  23. package/es/components/date_picker/super_date_picker/date_popover/absolute_tab.js +8 -2
  24. package/es/components/date_picker/super_date_picker/date_popover/date_popover_button.js +8 -2
  25. package/es/components/date_picker/super_date_picker/date_popover/date_popover_content.js +8 -2
  26. package/es/components/date_picker/super_date_picker/super_date_picker.js +27 -5
  27. package/es/components/drag_and_drop/draggable.js +13 -5
  28. package/es/components/header/header.styles.js +6 -12
  29. package/es/components/header/header_links/header_links.js +1 -1
  30. package/es/components/header/header_links/header_links.styles.js +1 -0
  31. package/es/components/page_template/inner/page_inner.styles.js +3 -4
  32. package/es/components/tabs/tab.js +1 -1
  33. package/eui.d.ts +417 -307
  34. package/i18ntokens.json +175 -175
  35. package/lib/components/datagrid/body/cell/data_grid_cell.styles.js +4 -2
  36. package/lib/components/datagrid/body/cell/focus_utils.js +14 -4
  37. package/lib/components/datagrid/body/data_grid_body.js +2 -1
  38. package/lib/components/datagrid/body/data_grid_body_custom.js +5 -2
  39. package/lib/components/datagrid/body/data_grid_body_virtualized.js +8 -4
  40. package/lib/components/datagrid/body/header/column_actions.js +265 -29
  41. package/lib/components/datagrid/body/header/{data_grid_column_resizer.js → column_resizer.js} +11 -5
  42. package/{optimize/lib/components/datagrid/body/header/data_grid_column_resizer.styles.js → lib/components/datagrid/body/header/column_resizer.styles.js} +6 -1
  43. package/lib/components/datagrid/body/header/column_sorting.js +144 -0
  44. package/lib/components/datagrid/body/header/data_grid_control_header_cell.js +3 -3
  45. package/lib/components/datagrid/body/header/data_grid_header_cell.js +86 -305
  46. package/lib/components/datagrid/body/header/data_grid_header_cell.styles.js +1 -1
  47. package/lib/components/datagrid/body/header/data_grid_header_cell_wrapper.js +19 -17
  48. package/lib/components/datagrid/body/header/data_grid_header_cell_wrapper.styles.js +1 -2
  49. package/lib/components/datagrid/body/header/data_grid_header_row.js +24 -9
  50. package/lib/components/datagrid/body/header/draggable_columns.js +308 -0
  51. package/lib/components/datagrid/body/header/draggable_columns.styles.js +42 -0
  52. package/lib/components/datagrid/data_grid.js +2 -1
  53. package/lib/components/datagrid/data_grid.stories.utils.js +9 -6
  54. package/lib/components/datagrid/utils/col_widths.js +4 -6
  55. package/lib/components/datagrid/utils/focus.js +2 -2
  56. package/lib/components/datagrid/utils/scrolling.js +13 -10
  57. package/lib/components/date_picker/super_date_picker/date_popover/absolute_tab.js +8 -2
  58. package/lib/components/date_picker/super_date_picker/date_popover/date_popover_button.js +8 -2
  59. package/lib/components/date_picker/super_date_picker/date_popover/date_popover_content.js +8 -2
  60. package/lib/components/date_picker/super_date_picker/super_date_picker.js +27 -5
  61. package/lib/components/drag_and_drop/draggable.js +13 -5
  62. package/lib/components/header/header.styles.js +6 -12
  63. package/lib/components/header/header_links/header_links.js +1 -1
  64. package/lib/components/header/header_links/header_links.styles.js +1 -0
  65. package/lib/components/page_template/inner/page_inner.styles.js +3 -4
  66. package/lib/components/tabs/tab.js +1 -1
  67. package/optimize/es/components/datagrid/body/cell/data_grid_cell.styles.js +4 -2
  68. package/optimize/es/components/datagrid/body/cell/focus_utils.js +13 -4
  69. package/optimize/es/components/datagrid/body/data_grid_body_custom.js +3 -1
  70. package/optimize/es/components/datagrid/body/data_grid_body_virtualized.js +6 -3
  71. package/optimize/es/components/datagrid/body/header/column_actions.js +250 -26
  72. package/optimize/es/components/datagrid/body/header/{data_grid_column_resizer.js → column_resizer.js} +8 -3
  73. package/optimize/es/components/datagrid/body/header/{data_grid_column_resizer.styles.js → column_resizer.styles.js} +6 -1
  74. package/optimize/es/components/datagrid/body/header/column_sorting.js +134 -0
  75. package/optimize/es/components/datagrid/body/header/data_grid_control_header_cell.js +2 -2
  76. package/optimize/es/components/datagrid/body/header/data_grid_header_cell.js +82 -302
  77. package/optimize/es/components/datagrid/body/header/data_grid_header_cell.styles.js +1 -1
  78. package/optimize/es/components/datagrid/body/header/data_grid_header_cell_wrapper.js +15 -14
  79. package/optimize/es/components/datagrid/body/header/data_grid_header_cell_wrapper.styles.js +1 -2
  80. package/optimize/es/components/datagrid/body/header/data_grid_header_row.js +25 -10
  81. package/optimize/es/components/datagrid/body/header/draggable_columns.js +223 -0
  82. package/optimize/es/components/datagrid/body/header/draggable_columns.styles.js +38 -0
  83. package/optimize/es/components/datagrid/data_grid.js +2 -1
  84. package/optimize/es/components/datagrid/data_grid.stories.utils.js +7 -5
  85. package/optimize/es/components/datagrid/utils/col_widths.js +4 -6
  86. package/optimize/es/components/datagrid/utils/focus.js +2 -2
  87. package/optimize/es/components/datagrid/utils/scrolling.js +13 -10
  88. package/optimize/es/components/date_picker/super_date_picker/date_popover/absolute_tab.js +5 -1
  89. package/optimize/es/components/date_picker/super_date_picker/date_popover/date_popover_button.js +6 -2
  90. package/optimize/es/components/date_picker/super_date_picker/date_popover/date_popover_content.js +6 -2
  91. package/optimize/es/components/date_picker/super_date_picker/super_date_picker.js +11 -5
  92. package/optimize/es/components/drag_and_drop/draggable.js +8 -3
  93. package/optimize/es/components/header/header.styles.js +6 -12
  94. package/optimize/es/components/header/header_links/header_links.js +1 -1
  95. package/optimize/es/components/header/header_links/header_links.styles.js +1 -0
  96. package/optimize/es/components/page_template/inner/page_inner.styles.js +3 -4
  97. package/optimize/es/components/tabs/tab.js +1 -1
  98. package/optimize/lib/components/datagrid/body/cell/data_grid_cell.styles.js +4 -2
  99. package/optimize/lib/components/datagrid/body/cell/focus_utils.js +13 -4
  100. package/optimize/lib/components/datagrid/body/data_grid_body_custom.js +3 -1
  101. package/optimize/lib/components/datagrid/body/data_grid_body_virtualized.js +6 -3
  102. package/optimize/lib/components/datagrid/body/header/column_actions.js +253 -27
  103. package/optimize/lib/components/datagrid/body/header/{data_grid_column_resizer.js → column_resizer.js} +9 -4
  104. package/{test-env/components/datagrid/body/header/data_grid_column_resizer.styles.js → optimize/lib/components/datagrid/body/header/column_resizer.styles.js} +6 -1
  105. package/optimize/lib/components/datagrid/body/header/column_sorting.js +144 -0
  106. package/optimize/lib/components/datagrid/body/header/data_grid_control_header_cell.js +2 -2
  107. package/optimize/lib/components/datagrid/body/header/data_grid_header_cell.js +80 -300
  108. package/optimize/lib/components/datagrid/body/header/data_grid_header_cell.styles.js +1 -1
  109. package/optimize/lib/components/datagrid/body/header/data_grid_header_cell_wrapper.js +15 -14
  110. package/optimize/lib/components/datagrid/body/header/data_grid_header_cell_wrapper.styles.js +1 -2
  111. package/optimize/lib/components/datagrid/body/header/data_grid_header_row.js +24 -9
  112. package/optimize/lib/components/datagrid/body/header/draggable_columns.js +231 -0
  113. package/optimize/lib/components/datagrid/body/header/draggable_columns.styles.js +43 -0
  114. package/optimize/lib/components/datagrid/data_grid.js +2 -1
  115. package/optimize/lib/components/datagrid/data_grid.stories.utils.js +7 -5
  116. package/optimize/lib/components/datagrid/utils/col_widths.js +4 -6
  117. package/optimize/lib/components/datagrid/utils/focus.js +2 -2
  118. package/optimize/lib/components/datagrid/utils/scrolling.js +13 -10
  119. package/optimize/lib/components/date_picker/super_date_picker/date_popover/absolute_tab.js +5 -1
  120. package/optimize/lib/components/date_picker/super_date_picker/date_popover/date_popover_button.js +6 -2
  121. package/optimize/lib/components/date_picker/super_date_picker/date_popover/date_popover_content.js +6 -2
  122. package/optimize/lib/components/date_picker/super_date_picker/super_date_picker.js +11 -5
  123. package/optimize/lib/components/drag_and_drop/draggable.js +8 -3
  124. package/optimize/lib/components/header/header.styles.js +6 -12
  125. package/optimize/lib/components/header/header_links/header_links.js +1 -1
  126. package/optimize/lib/components/header/header_links/header_links.styles.js +1 -0
  127. package/optimize/lib/components/page_template/inner/page_inner.styles.js +3 -4
  128. package/optimize/lib/components/tabs/tab.js +1 -1
  129. package/package.json +1 -1
  130. package/test-env/components/datagrid/body/cell/data_grid_cell.styles.js +4 -2
  131. package/test-env/components/datagrid/body/cell/focus_utils.js +13 -4
  132. package/test-env/components/datagrid/body/data_grid_body.js +2 -1
  133. package/test-env/components/datagrid/body/data_grid_body_custom.js +5 -2
  134. package/test-env/components/datagrid/body/data_grid_body_virtualized.js +8 -4
  135. package/test-env/components/datagrid/body/header/column_actions.js +261 -27
  136. package/test-env/components/datagrid/body/header/{data_grid_column_resizer.js → column_resizer.js} +11 -5
  137. package/{lib/components/datagrid/body/header/data_grid_column_resizer.styles.js → test-env/components/datagrid/body/header/column_resizer.styles.js} +6 -1
  138. package/test-env/components/datagrid/body/header/column_sorting.js +144 -0
  139. package/test-env/components/datagrid/body/header/data_grid_control_header_cell.js +3 -3
  140. package/test-env/components/datagrid/body/header/data_grid_header_cell.js +82 -301
  141. package/test-env/components/datagrid/body/header/data_grid_header_cell.styles.js +1 -1
  142. package/test-env/components/datagrid/body/header/data_grid_header_cell_wrapper.js +19 -17
  143. package/test-env/components/datagrid/body/header/data_grid_header_cell_wrapper.styles.js +1 -2
  144. package/test-env/components/datagrid/body/header/data_grid_header_row.js +24 -9
  145. package/test-env/components/datagrid/body/header/draggable_columns.js +305 -0
  146. package/test-env/components/datagrid/body/header/draggable_columns.styles.js +43 -0
  147. package/test-env/components/datagrid/data_grid.js +2 -1
  148. package/test-env/components/datagrid/data_grid.stories.utils.js +9 -6
  149. package/test-env/components/datagrid/utils/col_widths.js +4 -6
  150. package/test-env/components/datagrid/utils/focus.js +2 -2
  151. package/test-env/components/datagrid/utils/scrolling.js +13 -10
  152. package/test-env/components/date_picker/super_date_picker/date_popover/absolute_tab.js +8 -2
  153. package/test-env/components/date_picker/super_date_picker/date_popover/date_popover_button.js +8 -2
  154. package/test-env/components/date_picker/super_date_picker/date_popover/date_popover_content.js +8 -2
  155. package/test-env/components/date_picker/super_date_picker/super_date_picker.js +27 -5
  156. package/test-env/components/drag_and_drop/draggable.js +13 -5
  157. package/test-env/components/header/header.styles.js +6 -12
  158. package/test-env/components/header/header_links/header_links.js +1 -1
  159. package/test-env/components/header/header_links/header_links.styles.js +1 -0
  160. package/test-env/components/page_template/inner/page_inner.styles.js +3 -4
  161. package/test-env/components/tabs/tab.js +1 -1
@@ -0,0 +1,144 @@
1
+ "use strict";
2
+
3
+ var _typeof = require("@babel/runtime/helpers/typeof");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.useColumnSorting = void 0;
8
+ var _react = _interopRequireWildcard(require("react"));
9
+ var _services = require("../../../../services");
10
+ var _i18n = require("../../../i18n");
11
+ var _icon = require("../../../icon");
12
+ var _react2 = require("@emotion/react");
13
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
14
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
15
+ /*
16
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
17
+ * or more contributor license agreements. Licensed under the Elastic License
18
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
19
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
20
+ * Side Public License, v 1.
21
+ */
22
+
23
+ // Keep the i18n scope the same as EuiDataGridHeaderCell
24
+ /* eslint-disable local/i18n */
25
+
26
+ /**
27
+ * Column sorting utility helpers
28
+ */
29
+ var useColumnSorting = exports.useColumnSorting = function useColumnSorting(_ref) {
30
+ var _sorting$columns;
31
+ var sorting = _ref.sorting,
32
+ id = _ref.id,
33
+ hasColumnActions = _ref.hasColumnActions;
34
+ var sortedColumn = (0, _react.useMemo)(function () {
35
+ return sorting === null || sorting === void 0 ? void 0 : sorting.columns.find(function (col) {
36
+ return col.id === id;
37
+ });
38
+ }, [sorting, id]);
39
+ var isColumnSorted = !!sortedColumn;
40
+ var hasOnlyOneSort = (sorting === null || sorting === void 0 || (_sorting$columns = sorting.columns) === null || _sorting$columns === void 0 ? void 0 : _sorting$columns.length) === 1;
41
+
42
+ /**
43
+ * Arrow icon
44
+ */
45
+ var sortingArrow = (0, _react.useMemo)(function () {
46
+ return isColumnSorted ? (0, _react2.jsx)(_icon.EuiIcon, {
47
+ type: sortedColumn.direction === 'asc' ? 'sortUp' : 'sortDown',
48
+ color: "text",
49
+ className: "euiDataGridHeaderCell__sortingArrow",
50
+ "data-test-subj": "dataGridHeaderCellSortingIcon-".concat(id)
51
+ }) : null;
52
+ }, [id, isColumnSorted, sortedColumn]);
53
+
54
+ /**
55
+ * aria-sort attribute - should only be used when a single column is being sorted
56
+ * @see https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-sort
57
+ * @see https://www.w3.org/WAI/ARIA/apg/example-index/table/sortable-table.html
58
+ * @see https://github.com/w3c/aria/issues/283 for potential future multi-column usage
59
+ */
60
+ var ariaSort = isColumnSorted && hasOnlyOneSort ? sorting.columns[0].direction === 'asc' ? 'ascending' : 'descending' : undefined;
61
+
62
+ // aria-describedby ID for when aria-sort isn't sufficient
63
+ var sortingAriaId = (0, _services.useGeneratedHtmlId)({
64
+ prefix: 'euiDataGridCellHeader',
65
+ suffix: 'sorting'
66
+ });
67
+
68
+ /**
69
+ * Sorting status - screen reader text
70
+ */
71
+ var sortingScreenReaderText = (0, _react.useMemo)(function () {
72
+ var _sorting$columns2;
73
+ if (!isColumnSorted) return null;
74
+ if (!hasColumnActions && hasOnlyOneSort) return null; // in this scenario, the `aria-sort` attribute will be used by screen readers
75
+ return (0, _react2.jsx)("p", {
76
+ id: sortingAriaId,
77
+ hidden: true
78
+ }, sorting === null || sorting === void 0 || (_sorting$columns2 = sorting.columns) === null || _sorting$columns2 === void 0 ? void 0 : _sorting$columns2.map(function (_ref2, index) {
79
+ var columnId = _ref2.id,
80
+ direction = _ref2.direction;
81
+ if (hasOnlyOneSort) {
82
+ if (direction === 'asc') {
83
+ return (0, _react2.jsx)(_i18n.EuiI18n, {
84
+ token: "euiDataGridHeaderCell.sortedByAscendingSingle",
85
+ default: "Sorted ascending",
86
+ key: index
87
+ });
88
+ } else {
89
+ return (0, _react2.jsx)(_i18n.EuiI18n, {
90
+ token: "euiDataGridHeaderCell.sortedByDescendingSingle",
91
+ default: "Sorted descending",
92
+ key: index
93
+ });
94
+ }
95
+ } else if (index === 0) {
96
+ if (direction === 'asc') {
97
+ return (0, _react2.jsx)(_i18n.EuiI18n, {
98
+ token: "euiDataGridHeaderCell.sortedByAscendingFirst",
99
+ default: "Sorted by {columnId}, ascending",
100
+ values: {
101
+ columnId: columnId
102
+ },
103
+ key: index
104
+ });
105
+ } else {
106
+ return (0, _react2.jsx)(_i18n.EuiI18n, {
107
+ token: "euiDataGridHeaderCell.sortedByDescendingFirst",
108
+ default: "Sorted by {columnId}, descending",
109
+ values: {
110
+ columnId: columnId
111
+ },
112
+ key: index
113
+ });
114
+ }
115
+ } else {
116
+ if (direction === 'asc') {
117
+ return (0, _react2.jsx)(_i18n.EuiI18n, {
118
+ token: "euiDataGridHeaderCell.sortedByAscendingMultiple",
119
+ default: ", then sorted by {columnId}, ascending",
120
+ values: {
121
+ columnId: columnId
122
+ },
123
+ key: index
124
+ });
125
+ } else {
126
+ return (0, _react2.jsx)(_i18n.EuiI18n, {
127
+ token: "euiDataGridHeaderCell.sortedByDescendingMultiple",
128
+ default: ", then sorted by {columnId}, descending",
129
+ values: {
130
+ columnId: columnId
131
+ },
132
+ key: index
133
+ });
134
+ }
135
+ }
136
+ }), ".");
137
+ }, [isColumnSorted, hasColumnActions, hasOnlyOneSort, sorting, sortingAriaId]);
138
+ return {
139
+ sortingArrow: sortingArrow,
140
+ ariaSort: ariaSort,
141
+ sortingAriaId: sortingAriaId,
142
+ sortingScreenReaderText: sortingScreenReaderText
143
+ };
144
+ };
@@ -24,7 +24,7 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
24
24
  var EuiDataGridControlHeaderCell = exports.EuiDataGridControlHeaderCell = /*#__PURE__*/(0, _react.memo)(function (_ref) {
25
25
  var controlColumn = _ref.controlColumn,
26
26
  index = _ref.index,
27
- visibleColCount = _ref.visibleColCount;
27
+ isLastColumn = _ref.isLastColumn;
28
28
  var HeaderCellRender = controlColumn.headerCellRender,
29
29
  headerCellProps = controlColumn.headerCellProps,
30
30
  width = controlColumn.width,
@@ -34,7 +34,7 @@ var EuiDataGridControlHeaderCell = exports.EuiDataGridControlHeaderCell = /*#__P
34
34
  id: id,
35
35
  index: index,
36
36
  width: width,
37
- visibleColCount: visibleColCount
37
+ isLastColumn: isLastColumn
38
38
  }), (0, _react2.jsx)(HeaderCellRender, null));
39
39
  });
40
40
  EuiDataGridControlHeaderCell.displayName = 'EuiDataGridControlHeaderCell';
@@ -5,22 +5,18 @@ var _typeof = require("@babel/runtime/helpers/typeof");
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports.useSortingUtils = exports.usePopoverArrowNavigation = exports.EuiDataGridHeaderCell = void 0;
8
+ exports.EuiDataGridHeaderCell = void 0;
9
9
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
10
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
10
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
11
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
12
12
  var _classnames2 = _interopRequireDefault(require("classnames"));
13
13
  var _react = _interopRequireWildcard(require("react"));
14
- var _tabbable = require("tabbable");
15
14
  var _services = require("../../../../services");
16
- var _i18n = require("../../../i18n");
17
15
  var _icon = require("../../../icon");
18
- var _list_group = require("../../../list_group");
19
- var _popover = require("../../../popover");
20
- var _button = require("../../../button");
21
- var _focus = require("../../utils/focus");
22
16
  var _column_actions = require("./column_actions");
23
- var _data_grid_column_resizer = require("./data_grid_column_resizer");
17
+ var _column_sorting = require("./column_sorting");
18
+ var _draggable_columns = require("./draggable_columns");
19
+ var _column_resizer = require("./column_resizer");
24
20
  var _data_grid_header_cell_wrapper = require("./data_grid_header_cell_wrapper");
25
21
  var _data_grid_header_cell = require("./data_grid_header_cell.styles");
26
22
  var _react2 = require("@emotion/react");
@@ -41,315 +37,99 @@ var EuiDataGridHeaderCell = exports.EuiDataGridHeaderCell = /*#__PURE__*/(0, _re
41
37
  columnWidths = _ref.columnWidths,
42
38
  defaultColumnWidth = _ref.defaultColumnWidth,
43
39
  setColumnWidth = _ref.setColumnWidth,
44
- visibleColCount = _ref.visibleColCount,
45
40
  setVisibleColumns = _ref.setVisibleColumns,
46
41
  switchColumnPos = _ref.switchColumnPos,
42
+ isLastColumn = _ref.isLastColumn,
47
43
  sorting = _ref.sorting,
48
44
  schema = _ref.schema,
49
- schemaDetectors = _ref.schemaDetectors;
45
+ schemaDetectors = _ref.schemaDetectors,
46
+ canDragAndDropColumns = _ref.canDragAndDropColumns,
47
+ gridStyles = _ref.gridStyles;
50
48
  var id = column.id,
51
49
  display = column.display,
52
50
  displayAsText = column.displayAsText,
53
- displayHeaderCellProps = column.displayHeaderCellProps;
51
+ displayHeaderCellProps = column.displayHeaderCellProps,
52
+ actions = column.actions;
54
53
  var title = displayAsText || id;
55
54
  var children = display || displayAsText || id;
56
55
  var width = columnWidths[id] || defaultColumnWidth;
57
56
  var columnType = schema[id] ? schema[id].columnType : null;
58
- var _useContext = (0, _react.useContext)(_focus.DataGridFocusContext),
59
- setFocusedCell = _useContext.setFocusedCell,
60
- focusFirstVisibleInteractiveCell = _useContext.focusFirstVisibleInteractiveCell;
57
+ var hasColumnActions = (0, _column_actions.useHasColumnActions)(actions);
58
+ var classes = (0, _classnames2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)({}, "euiDataGridHeaderCell--".concat(columnType), columnType), 'euiDataGridHeaderCell--hasColumnActions', hasColumnActions), displayHeaderCellProps === null || displayHeaderCellProps === void 0 ? void 0 : displayHeaderCellProps.className);
59
+ var styles = (0, _services.useEuiMemoizedStyles)(_data_grid_header_cell.euiDataGridHeaderCellStyles);
60
+ var contentStyles = [styles.euiDataGridHeaderCell__content, (columnType === 'numeric' || columnType === 'currency') && styles.right];
61
61
 
62
- /*
63
- * Column actions
64
- */
65
- var _useState = (0, _react.useState)(false),
62
+ // Props passed from <ColumnActions /> to be set on <EuiDataGridHeaderCellWrapper />
63
+ var _useState = (0, _react.useState)({}),
66
64
  _useState2 = (0, _slicedToArray2.default)(_useState, 2),
67
- isPopoverOpen = _useState2[0],
68
- setIsPopoverOpen = _useState2[1];
69
- var togglePopover = (0, _react.useCallback)(function () {
70
- setIsPopoverOpen(function (isOpen) {
71
- return !isOpen;
72
- });
73
- }, []);
74
- var closePopover = (0, _react.useCallback)(function () {
75
- return setIsPopoverOpen(false);
76
- }, []);
77
- var popoverArrowNavigationProps = usePopoverArrowNavigation();
78
- var columnActions = (0, _react.useMemo)(function () {
79
- return (0, _column_actions.getColumnActions)({
80
- column: column,
81
- columns: columns,
82
- schema: schema,
83
- schemaDetectors: schemaDetectors,
84
- setVisibleColumns: setVisibleColumns,
85
- focusFirstVisibleInteractiveCell: focusFirstVisibleInteractiveCell,
86
- setIsPopoverOpen: setIsPopoverOpen,
87
- sorting: sorting,
88
- switchColumnPos: switchColumnPos,
89
- setFocusedCell: setFocusedCell,
90
- columnFocusIndex: index
91
- });
92
- }, [column, columns, schema, schemaDetectors, setVisibleColumns, focusFirstVisibleInteractiveCell, setIsPopoverOpen, sorting, switchColumnPos, setFocusedCell, index]);
93
- var showColumnActions = columnActions && columnActions.length > 0;
65
+ propsFromColumnActions = _useState2[0],
66
+ setPropsFromColumnActions = _useState2[1];
94
67
  var actionsButtonRef = (0, _react.useRef)(null);
95
- var clickActionsButton = (0, _react.useCallback)(function () {
96
- var _actionsButtonRef$cur;
97
- (_actionsButtonRef$cur = actionsButtonRef.current) === null || _actionsButtonRef$cur === void 0 || _actionsButtonRef$cur.click();
98
- }, []);
99
- var _useState3 = (0, _react.useState)(false),
100
- _useState4 = (0, _slicedToArray2.default)(_useState3, 2),
101
- isActionsButtonFocused = _useState4[0],
102
- setIsActionsButtonFocused = _useState4[1];
103
- var actionsButtonAriaLabel = (0, _i18n.useEuiI18n)('euiDataGridHeaderCell.actionsButtonAriaLabel', '{title}. Click to view column header actions.', {
104
- title: title
105
- });
106
- var actionsEnterKeyInstructions = (0, _i18n.useEuiI18n)('euiDataGridHeaderCell.actionsEnterKeyInstructions', "Press the Enter key to view this column's actions");
107
-
108
- /*
109
- * Column sorting
110
- */
111
- var _useSortingUtils = useSortingUtils({
68
+ var _useColumnSorting = (0, _column_sorting.useColumnSorting)({
112
69
  sorting: sorting,
113
70
  id: id,
114
- showColumnActions: showColumnActions
71
+ hasColumnActions: hasColumnActions
115
72
  }),
116
- sortingArrow = _useSortingUtils.sortingArrow,
117
- ariaSort = _useSortingUtils.ariaSort,
118
- sortingScreenReaderText = _useSortingUtils.sortingScreenReaderText;
119
- var sortingAriaId = (0, _services.useGeneratedHtmlId)({
120
- prefix: 'euiDataGridCellHeader',
121
- suffix: 'sorting'
122
- });
123
-
124
- /*
125
- * Rendering
126
- */
127
- var classes = (0, _classnames2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)({}, "euiDataGridHeaderCell--".concat(columnType), columnType), 'euiDataGridHeaderCell--hasColumnActions', showColumnActions), 'euiDataGridHeaderCell--isActionsPopoverOpen', isPopoverOpen), displayHeaderCellProps === null || displayHeaderCellProps === void 0 ? void 0 : displayHeaderCellProps.className);
128
- var styles = (0, _services.useEuiMemoizedStyles)(_data_grid_header_cell.euiDataGridHeaderCellStyles);
129
- var contentStyles = [styles.euiDataGridHeaderCell__content, (columnType === 'numeric' || columnType === 'currency') && styles.right];
130
- return (0, _react2.jsx)(_data_grid_header_cell_wrapper.EuiDataGridHeaderCellWrapper, (0, _extends2.default)({}, displayHeaderCellProps, {
131
- className: classes,
132
- id: id,
133
- index: index,
134
- visibleColCount: visibleColCount,
135
- width: width,
136
- "aria-sort": ariaSort,
137
- hasActionsPopover: showColumnActions,
138
- openActionsPopover: clickActionsButton,
139
- "aria-label": displayAsText && "".concat(displayAsText, ", ") // ensure cell text content is read first, if available
140
- ,
141
- "aria-describedby": sortingAriaId
142
- }), function (hasFocusTrap) {
143
- return (0, _react2.jsx)(_react.default.Fragment, null, column.isResizable !== false && width != null ? (0, _react2.jsx)(_data_grid_column_resizer.EuiDataGridColumnResizer, {
73
+ sortingArrow = _useColumnSorting.sortingArrow,
74
+ ariaSort = _useColumnSorting.ariaSort,
75
+ sortingAriaId = _useColumnSorting.sortingAriaId,
76
+ sortingScreenReaderText = _useColumnSorting.sortingScreenReaderText;
77
+ var columnResizer = (0, _react.useMemo)(function () {
78
+ return column.isResizable !== false && width != null ? (0, _react2.jsx)(_column_resizer.EuiDataGridColumnResizer, {
144
79
  columnId: id,
145
80
  columnWidth: width,
146
- setColumnWidth: setColumnWidth
147
- }) : null, (0, _react2.jsx)("div", {
148
- css: contentStyles,
149
- className: "euiDataGridHeaderCell__content",
150
- title: title
151
- }, children), sortingArrow, sortingScreenReaderText && (0, _react2.jsx)("p", {
152
- id: sortingAriaId,
153
- hidden: true
154
- }, sortingScreenReaderText), showColumnActions && (0, _react2.jsx)(_popover.EuiPopover, (0, _extends2.default)({
155
- display: "block",
156
- panelPaddingSize: "none",
157
- offset: 7,
158
- anchorPosition: "downRight",
159
- css: styles.euiDataGridHeaderCell__popover,
160
- button: (0, _react2.jsx)(_button.EuiButtonIcon, {
161
- iconType: "boxesVertical",
162
- iconSize: "s",
163
- color: "text",
164
- css: styles.euiDataGridHeaderCell__button,
165
- className: "euiDataGridHeaderCell__button",
166
- buttonRef: actionsButtonRef,
167
- onClick: togglePopover,
168
- onFocus: function onFocus() {
169
- return setIsActionsButtonFocused(true);
170
- },
171
- onBlur: function onBlur() {
172
- return setIsActionsButtonFocused(false);
173
- },
174
- tabIndex: 0 // Override EuiButtonIcon's conditional tabindex based on aria-hidden
175
- ,
176
- "aria-hidden": hasFocusTrap && !isActionsButtonFocused ? 'true' // prevent the actions button from being read on cell focus
177
- : undefined,
178
- "aria-label": hasFocusTrap ? actionsButtonAriaLabel : actionsEnterKeyInstructions,
179
- "data-test-subj": "dataGridHeaderCellActionButton-".concat(id)
180
- }),
181
- isOpen: isPopoverOpen,
182
- closePopover: closePopover
183
- }, popoverArrowNavigationProps), (0, _react2.jsx)(_list_group.EuiListGroup, {
184
- listItems: columnActions,
185
- gutterSize: "none",
186
- "data-test-subj": "dataGridHeaderCellActionGroup-".concat(id)
187
- })));
81
+ setColumnWidth: setColumnWidth,
82
+ isLastColumn: isLastColumn
83
+ }) : null;
84
+ }, [column.isResizable, id, width, setColumnWidth, isLastColumn]);
85
+ return (0, _react2.jsx)(_draggable_columns.ConditionalDraggableColumn, {
86
+ id: id,
87
+ index: index,
88
+ canDragAndDropColumns: !!canDragAndDropColumns,
89
+ gridStyles: gridStyles,
90
+ columnResizer: columnResizer,
91
+ actionsPopoverToggle: actionsButtonRef.current
92
+ }, function (dragProps) {
93
+ return (0, _react2.jsx)(_data_grid_header_cell_wrapper.EuiDataGridHeaderCellWrapper, (0, _extends2.default)({}, displayHeaderCellProps, dragProps, {
94
+ hasColumnActions: hasColumnActions
95
+ }, propsFromColumnActions, {
96
+ className: (0, _classnames2.default)(classes, propsFromColumnActions.className),
97
+ id: id,
98
+ index: index,
99
+ isLastColumn: isLastColumn,
100
+ width: width,
101
+ "aria-sort": ariaSort,
102
+ "aria-label": displayAsText && "".concat(displayAsText, ", ") // ensure cell text content is read first, if available
103
+ ,
104
+ "aria-describedby": (0, _classnames2.default)(sortingAriaId, dragProps === null || dragProps === void 0 ? void 0 : dragProps['aria-describedby']),
105
+ "data-column-moving": propsFromColumnActions['data-column-moving'] || (dragProps === null || dragProps === void 0 ? void 0 : dragProps['data-column-moving']) || undefined
106
+ }), function (hasFocusTrap) {
107
+ return (0, _react2.jsx)(_react.default.Fragment, null, !canDragAndDropColumns && columnResizer, canDragAndDropColumns && (0, _react2.jsx)("span", {
108
+ className: "euiDataGridHeaderCell__draggableIcon"
109
+ }, (0, _react2.jsx)(_icon.EuiIcon, {
110
+ type: "grabOmnidirectional",
111
+ size: "s",
112
+ css: styles.euiDataGridHeaderCell__actions
113
+ })), (0, _react2.jsx)("div", {
114
+ css: contentStyles,
115
+ className: "euiDataGridHeaderCell__content",
116
+ title: title
117
+ }, children), sortingArrow, sortingScreenReaderText, hasColumnActions && (0, _react2.jsx)(_column_actions.ColumnActions, {
118
+ index: index,
119
+ id: id,
120
+ title: title,
121
+ column: column,
122
+ columns: columns,
123
+ schema: schema,
124
+ schemaDetectors: schemaDetectors,
125
+ setVisibleColumns: setVisibleColumns,
126
+ switchColumnPos: switchColumnPos,
127
+ sorting: sorting,
128
+ hasFocusTrap: hasFocusTrap,
129
+ setPropsFromColumnActions: setPropsFromColumnActions,
130
+ actionsButtonRef: actionsButtonRef
131
+ }));
132
+ });
188
133
  });
189
134
  });
190
- EuiDataGridHeaderCell.displayName = 'EuiDataGridHeaderCell';
191
-
192
- /**
193
- * Column sorting utility helpers
194
- */
195
- var useSortingUtils = exports.useSortingUtils = function useSortingUtils(_ref2) {
196
- var _sorting$columns;
197
- var sorting = _ref2.sorting,
198
- id = _ref2.id,
199
- showColumnActions = _ref2.showColumnActions;
200
- var sortedColumn = (0, _react.useMemo)(function () {
201
- return sorting === null || sorting === void 0 ? void 0 : sorting.columns.find(function (col) {
202
- return col.id === id;
203
- });
204
- }, [sorting, id]);
205
- var isColumnSorted = !!sortedColumn;
206
- var hasOnlyOneSort = (sorting === null || sorting === void 0 || (_sorting$columns = sorting.columns) === null || _sorting$columns === void 0 ? void 0 : _sorting$columns.length) === 1;
207
-
208
- /**
209
- * Arrow icon
210
- */
211
- var sortingArrow = (0, _react.useMemo)(function () {
212
- return isColumnSorted ? (0, _react2.jsx)(_icon.EuiIcon, {
213
- type: sortedColumn.direction === 'asc' ? 'sortUp' : 'sortDown',
214
- color: "text",
215
- className: "euiDataGridHeaderCell__sortingArrow",
216
- "data-test-subj": "dataGridHeaderCellSortingIcon-".concat(id)
217
- }) : null;
218
- }, [id, isColumnSorted, sortedColumn]);
219
-
220
- /**
221
- * aria-sort attribute - should only be used when a single column is being sorted
222
- * @see https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-sort
223
- * @see https://www.w3.org/WAI/ARIA/apg/example-index/table/sortable-table.html
224
- * @see https://github.com/w3c/aria/issues/283 for potential future multi-column usage
225
- */
226
- var ariaSort = isColumnSorted && hasOnlyOneSort ? sorting.columns[0].direction === 'asc' ? 'ascending' : 'descending' : undefined;
227
-
228
- /**
229
- * Sorting status - screen reader text
230
- */
231
- var sortingScreenReaderText = (0, _react.useMemo)(function () {
232
- var _sorting$columns2;
233
- if (!isColumnSorted) return null;
234
- if (!showColumnActions && hasOnlyOneSort) return null; // in this scenario, the `aria-sort` attribute will be used by screen readers
235
- return (0, _react2.jsx)(_react.default.Fragment, null, sorting === null || sorting === void 0 || (_sorting$columns2 = sorting.columns) === null || _sorting$columns2 === void 0 ? void 0 : _sorting$columns2.map(function (_ref3, index) {
236
- var columnId = _ref3.id,
237
- direction = _ref3.direction;
238
- if (hasOnlyOneSort) {
239
- if (direction === 'asc') {
240
- return (0, _react2.jsx)(_i18n.EuiI18n, {
241
- token: "euiDataGridHeaderCell.sortedByAscendingSingle",
242
- default: "Sorted ascending",
243
- key: index
244
- });
245
- } else {
246
- return (0, _react2.jsx)(_i18n.EuiI18n, {
247
- token: "euiDataGridHeaderCell.sortedByDescendingSingle",
248
- default: "Sorted descending",
249
- key: index
250
- });
251
- }
252
- } else if (index === 0) {
253
- if (direction === 'asc') {
254
- return (0, _react2.jsx)(_i18n.EuiI18n, {
255
- token: "euiDataGridHeaderCell.sortedByAscendingFirst",
256
- default: "Sorted by {columnId}, ascending",
257
- values: {
258
- columnId: columnId
259
- },
260
- key: index
261
- });
262
- } else {
263
- return (0, _react2.jsx)(_i18n.EuiI18n, {
264
- token: "euiDataGridHeaderCell.sortedByDescendingFirst",
265
- default: "Sorted by {columnId}, descending",
266
- values: {
267
- columnId: columnId
268
- },
269
- key: index
270
- });
271
- }
272
- } else {
273
- if (direction === 'asc') {
274
- return (0, _react2.jsx)(_i18n.EuiI18n, {
275
- token: "euiDataGridHeaderCell.sortedByAscendingMultiple",
276
- default: ", then sorted by {columnId}, ascending",
277
- values: {
278
- columnId: columnId
279
- },
280
- key: index
281
- });
282
- } else {
283
- return (0, _react2.jsx)(_i18n.EuiI18n, {
284
- token: "euiDataGridHeaderCell.sortedByDescendingMultiple",
285
- default: ", then sorted by {columnId}, descending",
286
- values: {
287
- columnId: columnId
288
- },
289
- key: index
290
- });
291
- }
292
- }
293
- }), ".");
294
- }, [isColumnSorted, showColumnActions, hasOnlyOneSort, sorting]);
295
- return {
296
- sortingArrow: sortingArrow,
297
- ariaSort: ariaSort,
298
- sortingScreenReaderText: sortingScreenReaderText
299
- };
300
- };
301
-
302
- /**
303
- * Add keyboard arrow navigation to the cell actions popover
304
- * to match the UX of the rest of EuiDataGrid
305
- */
306
- var usePopoverArrowNavigation = exports.usePopoverArrowNavigation = function usePopoverArrowNavigation() {
307
- var popoverPanelRef = (0, _react.useRef)(null);
308
- var actionsRef = (0, _react.useRef)(undefined);
309
- var panelRef = (0, _react.useCallback)(function (ref) {
310
- popoverPanelRef.current = ref;
311
- actionsRef.current = ref ? (0, _tabbable.tabbable)(ref) : undefined;
312
- }, []);
313
- var onKeyDown = (0, _react.useCallback)(function (e) {
314
- var _actionsRef$current;
315
- if (e.key !== _services.keys.ARROW_DOWN && e.key !== _services.keys.ARROW_UP) return;
316
- if (!((_actionsRef$current = actionsRef.current) !== null && _actionsRef$current !== void 0 && _actionsRef$current.length)) return;
317
- e.preventDefault();
318
- var initialState = document.activeElement === popoverPanelRef.current;
319
- var currentIndex = !initialState ? actionsRef.current.findIndex(function (el) {
320
- return document.activeElement === el;
321
- }) : -1;
322
- var lastIndex = actionsRef.current.length - 1;
323
- var indexToFocus;
324
- if (initialState) {
325
- if (e.key === _services.keys.ARROW_DOWN) {
326
- indexToFocus = 0;
327
- } else if (e.key === _services.keys.ARROW_UP) {
328
- indexToFocus = lastIndex;
329
- }
330
- } else {
331
- if (e.key === _services.keys.ARROW_DOWN) {
332
- indexToFocus = currentIndex + 1;
333
- if (indexToFocus > lastIndex) {
334
- indexToFocus = 0;
335
- }
336
- } else if (e.key === _services.keys.ARROW_UP) {
337
- indexToFocus = currentIndex - 1;
338
- if (indexToFocus < 0) {
339
- indexToFocus = lastIndex;
340
- }
341
- }
342
- }
343
- actionsRef.current[indexToFocus].focus();
344
- }, []);
345
- return {
346
- panelRef: panelRef,
347
- panelProps: {
348
- onKeyDown: onKeyDown
349
- },
350
- popoverScreenReaderText: (0, _react2.jsx)(_i18n.EuiI18n, {
351
- token: "euiDataGridHeaderCell.actionsPopoverScreenReaderText",
352
- default: "To navigate through the list of column actions, press the Tab or Up and Down arrow keys."
353
- })
354
- };
355
- };
135
+ EuiDataGridHeaderCell.displayName = 'EuiDataGridHeaderCell';
@@ -27,6 +27,6 @@ var euiDataGridHeaderCellStyles = exports.euiDataGridHeaderCellStyles = function
27
27
  // Numeric and currency schemas are aligned to the right
28
28
  right: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalTextAlignCSS)('right'), ";;label:right;"),
29
29
  euiDataGridHeaderCell__popover: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('margin-left', 'auto'), "line-height:0;;label:euiDataGridHeaderCell__popover;"),
30
- euiDataGridHeaderCell__button: /*#__PURE__*/(0, _react.css)("overflow:hidden;", header.hideActions, " &{", (0, _global_styling.logicalCSS)('width', 0), " opacity:0;}", _global_styling.euiCanAnimate, "{transition:inline-size ", euiTheme.animation.fast, " ease-in,opacity ", euiTheme.animation.slow, " ease-in;transform:none!important;animation:none!important;};label:euiDataGridHeaderCell__button;")
30
+ euiDataGridHeaderCell__actions: /*#__PURE__*/(0, _react.css)("overflow:hidden;display:flex;", header.hideActions, " &{", (0, _global_styling.logicalCSS)('width', 0), " opacity:0;}", _global_styling.euiCanAnimate, "{transition:inline-size ", euiTheme.animation.fast, " ease-in,opacity ", euiTheme.animation.slow, " ease-in;transform:none!important;animation:none!important;};label:euiDataGridHeaderCell__actions;")
31
31
  };
32
32
  };
@@ -16,7 +16,7 @@ var _focus = require("../../utils/focus");
16
16
  var _focus_utils = require("../cell/focus_utils");
17
17
  var _data_grid_header_cell_wrapper = require("./data_grid_header_cell_wrapper.styles");
18
18
  var _react2 = require("@emotion/react");
19
- var _excluded = ["id", "index", "visibleColCount", "width", "className", "children", "hasActionsPopover", "openActionsPopover", "aria-label"];
19
+ var _excluded = ["id", "index", "isLastColumn", "width", "className", "children", "hasColumnActions", "isDragging", "onKeyDown", "aria-label"];
20
20
  /*
21
21
  * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
22
22
  * or more contributor license agreements. Licensed under the Elastic License
@@ -34,12 +34,13 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
34
34
  var EuiDataGridHeaderCellWrapper = exports.EuiDataGridHeaderCellWrapper = function EuiDataGridHeaderCellWrapper(_ref) {
35
35
  var id = _ref.id,
36
36
  index = _ref.index,
37
- visibleColCount = _ref.visibleColCount,
37
+ isLastColumn = _ref.isLastColumn,
38
38
  width = _ref.width,
39
39
  className = _ref.className,
40
40
  children = _ref.children,
41
- hasActionsPopover = _ref.hasActionsPopover,
42
- openActionsPopover = _ref.openActionsPopover,
41
+ hasColumnActions = _ref.hasColumnActions,
42
+ isDragging = _ref.isDragging,
43
+ _onKeyDown = _ref.onKeyDown,
43
44
  ariaLabel = _ref['aria-label'],
44
45
  rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
45
46
  var classes = (0, _classnames.default)('euiDataGridHeaderCell', className);
@@ -60,8 +61,8 @@ var EuiDataGridHeaderCellWrapper = exports.EuiDataGridHeaderCellWrapper = functi
60
61
  setInteractiveChildren = _useState6[1];
61
62
  (0, _react.useEffect)(function () {
62
63
  // We're checking for interactive children outside of the default actions button
63
- setRenderFocusTrap(interactiveChildren.length > (hasActionsPopover ? 1 : 0));
64
- }, [hasActionsPopover, interactiveChildren]);
64
+ setRenderFocusTrap(interactiveChildren.length > (hasColumnActions ? 1 : 0));
65
+ }, [hasColumnActions, interactiveChildren]);
65
66
  var _useContext = (0, _react.useContext)(_focus.DataGridFocusContext),
66
67
  setFocusedCell = _useContext.setFocusedCell,
67
68
  onFocusUpdate = _useContext.onFocusUpdate;
@@ -83,14 +84,14 @@ var EuiDataGridHeaderCellWrapper = exports.EuiDataGridHeaderCellWrapper = functi
83
84
  }
84
85
  });
85
86
  }, [index, onFocusUpdate, headerEl]);
86
-
87
- // For cell headers with only actions, auto-open the actions popover on enter keypress
88
87
  var onKeyDown = (0, _react.useCallback)(function (e) {
89
- if (e.key === _services.keys.ENTER && hasActionsPopover && !renderFocusTrap && e.target === headerEl) {
90
- openActionsPopover === null || openActionsPopover === void 0 || openActionsPopover();
88
+ // Ignore keys that conflict with the focus trap being entered/exited
89
+ if (renderFocusTrap && (e.key === _services.keys.ENTER || e.key === _services.keys.ESCAPE)) {
90
+ return;
91
91
  }
92
- }, [hasActionsPopover, openActionsPopover, renderFocusTrap, headerEl]);
93
- var isLastColumn = index === visibleColCount - 1;
92
+ // Otherwise, continue with whatever onKeyDown is being passed
93
+ _onKeyDown === null || _onKeyDown === void 0 || _onKeyDown(e);
94
+ }, [_onKeyDown, renderFocusTrap]);
94
95
  return (0, _react2.jsx)("div", (0, _extends2.default)({
95
96
  role: "columnheader",
96
97
  ref: setHeaderEl,
@@ -108,9 +109,9 @@ var EuiDataGridHeaderCellWrapper = exports.EuiDataGridHeaderCellWrapper = functi
108
109
  } : {},
109
110
  "aria-label": renderFocusTrap ? ariaLabel : undefined
110
111
  }, rest), (0, _react2.jsx)(_focus_utils.HandleInteractiveChildren, {
111
- cellEl: headerEl,
112
+ cellEl: isDragging ? null : headerEl,
113
+ renderFocusTrap: isDragging ? false : renderFocusTrap,
112
114
  updateCellFocusContext: updateCellFocusContext,
113
- renderFocusTrap: renderFocusTrap,
114
115
  onInteractiveChildrenFound: setInteractiveChildren
115
116
  }, typeof children === 'function' ? children(renderFocusTrap) : children), isLastColumn ? _services.tabularCopyMarkers.hiddenNewline : _services.tabularCopyMarkers.hiddenTab);
116
117
  };