@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
@@ -47,6 +47,7 @@ var euiDataGridCellOutlineSelectors = exports.euiDataGridCellOutlineSelectors =
47
47
 
48
48
  // Cell header specific selectors
49
49
  var headerActionsOpen = '.euiDataGridHeaderCell--isActionsPopoverOpen';
50
+ var isMoving = '[data-column-moving]'; // prevents the header column actions hover animation from replaying on column move
50
51
 
51
52
  // Utils
52
53
  var selectors = function selectors() {
@@ -80,10 +81,11 @@ var euiDataGridCellOutlineSelectors = exports.euiDataGridCellOutlineSelectors =
80
81
  hoverAnimation: hoverNot(selectors(focus, isOpen, isClosing))
81
82
  },
82
83
  header: {
83
- focus: is(selectors(focus, focusWithin, headerActionsOpen)),
84
+ focus: is(selectors(focus, focusWithin, headerActionsOpen, isMoving)),
84
85
  // :focus-within here is primarily intended for when the column actions button has been clicked twice
85
86
  focusTrapped: _(isEntered),
86
- hideActions: not(selectors(hover, focusWithin, headerActionsOpen))
87
+ showActions: is(selectors(hover, focusWithin, headerActionsOpen, isMoving)),
88
+ hideActions: not(selectors(hover, focusWithin, headerActionsOpen, isMoving))
87
89
  }
88
90
  };
89
91
  };
@@ -17,6 +17,8 @@ var _react2 = require("@emotion/react");
17
17
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
18
18
  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); }
19
19
  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; }
20
+ function _toArray(r) { return _arrayWithHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableRest(); }
21
+ function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
20
22
  function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
21
23
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
22
24
  function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
@@ -110,16 +112,24 @@ var FocusTrappedChildren = exports.FocusTrappedChildren = function FocusTrappedC
110
112
 
111
113
  // direct DOM manipulation as workaround to attach required hints
112
114
  (0, _react.useEffect)(function () {
115
+ var _currentAriaDescribed;
113
116
  var currentAriaDescribedbyId = cellEl.getAttribute('aria-describedby');
114
- cellEl.setAttribute('aria-describedby', (0, _classnames.default)(currentAriaDescribedbyId, ariaDescribedById));
117
+ // A11y: splitting ids to be able to append the first hint (sorting)
118
+ // while other hints should follow the keyboard navigation hints
119
+ var _ref3 = (_currentAriaDescribed = currentAriaDescribedbyId === null || currentAriaDescribedbyId === void 0 ? void 0 : currentAriaDescribedbyId.split(' ')) !== null && _currentAriaDescribed !== void 0 ? _currentAriaDescribed : [],
120
+ _ref4 = _toArray(_ref3),
121
+ sortingId = _ref4[0],
122
+ rest = _ref4.slice(1);
123
+ var remainingIds = rest.join(' ');
124
+ cellEl.setAttribute('aria-describedby', (0, _classnames.default)(sortingId, ariaDescribedById, !isCellEntered && remainingIds));
115
125
  return function () {
116
126
  if (currentAriaDescribedbyId) {
117
- cellEl.setAttribute('aria-descibedby', currentAriaDescribedbyId);
127
+ cellEl.setAttribute('aria-describedby', currentAriaDescribedbyId);
118
128
  } else {
119
129
  cellEl.removeAttribute('aria-describedby');
120
130
  }
121
131
  };
122
- }, [cellEl, ariaDescribedById]);
132
+ }, [cellEl, ariaDescribedById, isCellEntered]);
123
133
  (0, _react.useEffect)(function () {
124
134
  if (isCellEntered) {
125
135
  enableAndFocusInteractives(cellEl);
@@ -147,7 +157,7 @@ var FocusTrappedChildren = exports.FocusTrappedChildren = function FocusTrappedC
147
157
  } else if (
148
158
  // when opened content is closed, we don't want Escape to return to the cell
149
159
  // immediately but instead return focus to a trigger as expected
150
- isCellEntered === false && (0, _utils.isDOMNode)(event.target) && (0, _utils.isDOMNode)(event.currentTarget) && event.currentTarget.contains(event.target)) {
160
+ isCellEntered === false && (0, _utils.isDOMNode)(event.target) && (0, _utils.isDOMNode)(event.currentTarget) && event.currentTarget !== event.target && event.currentTarget.contains(event.target)) {
151
161
  return true;
152
162
  }
153
163
  return isCellEntered;
@@ -659,5 +659,6 @@ EuiDataGridBody.propTypes = {
659
659
  gridRef: _propTypes.default.any.isRequired,
660
660
  gridItemsRendered: _propTypes.default.any.isRequired,
661
661
  wrapperRef: _propTypes.default.any.isRequired,
662
- className: _propTypes.default.string
662
+ className: _propTypes.default.string,
663
+ canDragAndDropColumns: _propTypes.default.bool
663
664
  };
@@ -56,6 +56,7 @@ var EuiDataGridBodyCustomRender = exports.EuiDataGridBodyCustomRender = /*#__PUR
56
56
  columns = _ref.columns,
57
57
  setVisibleColumns = _ref.setVisibleColumns,
58
58
  switchColumnPos = _ref.switchColumnPos,
59
+ canDragAndDropColumns = _ref.canDragAndDropColumns,
59
60
  onColumnResize = _ref.onColumnResize,
60
61
  schema = _ref.schema,
61
62
  schemaDetectors = _ref.schemaDetectors,
@@ -109,12 +110,13 @@ var EuiDataGridBodyCustomRender = exports.EuiDataGridBodyCustomRender = /*#__PUR
109
110
  setVisibleColumns: setVisibleColumns,
110
111
  visibleColCount: visibleColCount,
111
112
  switchColumnPos: switchColumnPos,
113
+ canDragAndDropColumns: canDragAndDropColumns,
112
114
  sorting: sorting,
113
115
  schema: schema,
114
116
  schemaDetectors: schemaDetectors,
115
117
  gridStyles: gridStyles
116
118
  };
117
- }, [leadingControlColumns, trailingControlColumns, columns, columnWidths, defaultColumnWidth, setColumnWidth, visibleColCount, setVisibleColumns, switchColumnPos, sorting, schema, schemaDetectors, gridStyles]);
119
+ }, [leadingControlColumns, trailingControlColumns, columns, columnWidths, defaultColumnWidth, setColumnWidth, visibleColCount, setVisibleColumns, switchColumnPos, canDragAndDropColumns, sorting, schema, schemaDetectors, gridStyles]);
118
120
 
119
121
  /**
120
122
  * Header & footer
@@ -823,6 +825,7 @@ EuiDataGridBodyCustomRender.propTypes = {
823
825
  gridRef: _propTypes.default.any.isRequired,
824
826
  gridItemsRendered: _propTypes.default.any.isRequired,
825
827
  wrapperRef: _propTypes.default.any.isRequired,
826
- className: _propTypes.default.string
828
+ className: _propTypes.default.string,
829
+ canDragAndDropColumns: _propTypes.default.bool
827
830
  };
828
831
  EuiDataGridBodyCustomRender.displayName = 'EuiDataGridBodyCustomRender';
@@ -116,7 +116,8 @@ var EuiDataGridBodyVirtualized = exports.EuiDataGridBodyVirtualized = /*#__PURE_
116
116
  gridRef = _ref3.gridRef,
117
117
  gridItemsRendered = _ref3.gridItemsRendered,
118
118
  wrapperRef = _ref3.wrapperRef,
119
- className = _ref3.className;
119
+ className = _ref3.className,
120
+ canDragAndDropColumns = _ref3.canDragAndDropColumns;
120
121
  /**
121
122
  * Grid refs & observers
122
123
  */
@@ -167,7 +168,8 @@ var EuiDataGridBodyVirtualized = exports.EuiDataGridBodyVirtualized = /*#__PURE_
167
168
  sorting: sorting,
168
169
  schema: schema,
169
170
  schemaDetectors: schemaDetectors,
170
- gridStyles: gridStyles
171
+ gridStyles: gridStyles,
172
+ canDragAndDropColumns: canDragAndDropColumns
171
173
  }),
172
174
  headerRow = _useDataGridHeader.headerRow,
173
175
  headerRowHeight = _useDataGridHeader.headerRowHeight;
@@ -199,7 +201,8 @@ var EuiDataGridBodyVirtualized = exports.EuiDataGridBodyVirtualized = /*#__PURE_
199
201
  headerRowHeight: headerRowHeight,
200
202
  footerRowHeight: footerRowHeight,
201
203
  visibleRowCount: visibleRowCount,
202
- hasStickyFooter: !!(renderFooterCellValue && gridStyles.stickyFooter)
204
+ hasStickyFooter: !!(renderFooterCellValue && gridStyles.stickyFooter),
205
+ canDragAndDropColumns: canDragAndDropColumns
203
206
  });
204
207
 
205
208
  /**
@@ -947,6 +950,7 @@ EuiDataGridBodyVirtualized.propTypes = {
947
950
  gridRef: _propTypes.default.any.isRequired,
948
951
  gridItemsRendered: _propTypes.default.any.isRequired,
949
952
  wrapperRef: _propTypes.default.any.isRequired,
950
- className: _propTypes.default.string
953
+ className: _propTypes.default.string,
954
+ canDragAndDropColumns: _propTypes.default.bool
951
955
  };
952
956
  EuiDataGridBodyVirtualized.displayName = 'EuiDataGridBodyVirtualized';
@@ -3,13 +3,23 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.isColumnActionEnabled = exports.getSortColumnActions = exports.getHideColumnAction = exports.getColumnActions = exports.getColumnActionConfig = void 0;
7
- var _react = _interopRequireDefault(require("react"));
6
+ exports.usePopoverArrowNavigation = exports.useHasColumnActions = exports.isColumnActionEnabled = exports.getSortColumnActions = exports.getHideColumnAction = exports.getColumnActions = exports.getColumnActionConfig = exports.ColumnActions = void 0;
7
+ var _react = _interopRequireWildcard(require("react"));
8
+ var _propTypes = _interopRequireDefault(require("prop-types"));
9
+ var _tabbable = require("tabbable");
10
+ var _services = require("../../../../services");
8
11
  var _i18n = require("../../../i18n");
12
+ var _popover = require("../../../popover");
13
+ var _list_group = require("../../../list_group");
14
+ var _button = require("../../../button");
15
+ var _focus = require("../../utils/focus");
9
16
  var _data_grid_schema = require("../../utils/data_grid_schema");
10
17
  var _column_sorting_draggable = require("../../controls/column_sorting_draggable");
18
+ var _data_grid_header_cell = require("./data_grid_header_cell.styles");
11
19
  var _react2 = require("@emotion/react");
12
20
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
21
+ 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); }
22
+ 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; }
13
23
  function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
14
24
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
15
25
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
@@ -18,29 +28,243 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
18
28
  function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
19
29
  function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
20
30
  function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
21
- function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
22
31
  function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
23
32
  function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
24
- function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; } /*
33
+ function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
34
+ function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
35
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
36
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
37
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
38
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
39
+ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; } /*
25
40
  * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
26
41
  * or more contributor license agreements. Licensed under the Elastic License
27
42
  * 2.0 and the Server Side Public License, v 1; you may not use this file except
28
43
  * in compliance with, at your election, the Elastic License 2.0 or the Server
29
44
  * Side Public License, v 1.
30
- */
31
- var getColumnActions = exports.getColumnActions = function getColumnActions(_ref) {
32
- var _column$actions;
33
- var column = _ref.column,
45
+ */ // Keep the i18n scope the same as EuiDataGridHeaderCell
46
+ /* eslint-disable local/i18n */
47
+ var useHasColumnActions = exports.useHasColumnActions = function useHasColumnActions(columnActions) {
48
+ return (0, _react.useMemo)(function () {
49
+ // By default, all column actions are enabled
50
+ if (columnActions === undefined) return true;
51
+ if (columnActions === false) return false;
52
+ if (columnActions.additional && columnActions.additional.length) return true;
53
+ // Check if all (currently 5) default column actions have been manually disabled
54
+ var disabledActions = Object.values(columnActions).filter(function (action) {
55
+ return action === false;
56
+ });
57
+ return disabledActions.length < 5;
58
+ }, [columnActions]);
59
+ };
60
+
61
+ // Props to pass back to EuiDataGridHeaderCell and set on EuiDataGridHeaderCellWrapper
62
+
63
+ var ColumnActions = exports.ColumnActions = /*#__PURE__*/(0, _react.memo)(function (_ref) {
64
+ var index = _ref.index,
65
+ id = _ref.id,
66
+ title = _ref.title,
67
+ column = _ref.column,
34
68
  columns = _ref.columns,
35
69
  schema = _ref.schema,
36
70
  schemaDetectors = _ref.schemaDetectors,
37
71
  setVisibleColumns = _ref.setVisibleColumns,
38
- focusFirstVisibleInteractiveCell = _ref.focusFirstVisibleInteractiveCell,
39
- setIsPopoverOpen = _ref.setIsPopoverOpen,
40
- sorting = _ref.sorting,
41
72
  switchColumnPos = _ref.switchColumnPos,
42
- setFocusedCell = _ref.setFocusedCell,
43
- columnFocusIndex = _ref.columnFocusIndex;
73
+ sorting = _ref.sorting,
74
+ hasFocusTrap = _ref.hasFocusTrap,
75
+ setPropsFromColumnActions = _ref.setPropsFromColumnActions,
76
+ actionsButtonRef = _ref.actionsButtonRef;
77
+ /**
78
+ * Popover logic and accessibility
79
+ */
80
+ var _useState = (0, _react.useState)(false),
81
+ _useState2 = _slicedToArray(_useState, 2),
82
+ isPopoverOpen = _useState2[0],
83
+ setIsPopoverOpen = _useState2[1];
84
+ var togglePopover = (0, _react.useCallback)(function () {
85
+ setIsPopoverOpen(function (isOpen) {
86
+ return !isOpen;
87
+ });
88
+ }, []);
89
+ var closePopover = (0, _react.useCallback)(function () {
90
+ setIsPopoverOpen(false);
91
+ }, []);
92
+ var _useState3 = (0, _react.useState)(false),
93
+ _useState4 = _slicedToArray(_useState3, 2),
94
+ isActionsButtonFocused = _useState4[0],
95
+ setIsActionsButtonFocused = _useState4[1];
96
+ var onFocus = (0, _react.useCallback)(function () {
97
+ return setIsActionsButtonFocused(true);
98
+ }, []);
99
+ var onBlur = (0, _react.useCallback)(function () {
100
+ return setIsActionsButtonFocused(false);
101
+ }, []);
102
+ var actionsButtonAriaLabel = (0, _i18n.useEuiI18n)('euiDataGridHeaderCell.actionsButtonAriaLabel', '{title}. Click to view column header actions.', {
103
+ title: title
104
+ });
105
+ var actionsEnterKeyInstructions = (0, _i18n.useEuiI18n)('euiDataGridHeaderCell.actionsEnterKeyInstructions', "Press the Enter key to view this column's actions");
106
+ var openActionsPopoverOnEnter = (0, _react.useCallback)(function (e) {
107
+ if (e.key === _services.keys.ENTER) {
108
+ setIsPopoverOpen(true);
109
+ }
110
+ }, []);
111
+ var popoverArrowNavigationProps = usePopoverArrowNavigation();
112
+
113
+ /**
114
+ * Props to set on parent EuiDataGridHeaderCell
115
+ */
116
+ var _useState5 = (0, _react.useState)(false),
117
+ _useState6 = _slicedToArray(_useState5, 2),
118
+ isColumnMoving = _useState6[0],
119
+ setIsColumnMoving = _useState6[1];
120
+ (0, _react.useEffect)(function () {
121
+ setPropsFromColumnActions({
122
+ className: isPopoverOpen ? 'euiDataGridHeaderCell--isActionsPopoverOpen' : '',
123
+ onKeyDown: openActionsPopoverOnEnter,
124
+ 'data-column-moving': isColumnMoving || undefined
125
+ });
126
+ }, [setPropsFromColumnActions, isPopoverOpen, openActionsPopoverOnEnter, isColumnMoving]);
127
+
128
+ /**
129
+ * Get column actions as an array of EuiListGroup items
130
+ */
131
+ var _useContext = (0, _react.useContext)(_focus.DataGridFocusContext),
132
+ setFocusedCell = _useContext.setFocusedCell,
133
+ focusFirstVisibleInteractiveCell = _useContext.focusFirstVisibleInteractiveCell;
134
+ var columnActions = (0, _react.useMemo)(function () {
135
+ return getColumnActions({
136
+ column: column,
137
+ columns: columns,
138
+ schema: schema,
139
+ schemaDetectors: schemaDetectors,
140
+ setVisibleColumns: setVisibleColumns,
141
+ focusFirstVisibleInteractiveCell: focusFirstVisibleInteractiveCell,
142
+ sorting: sorting,
143
+ switchColumnPos: switchColumnPos,
144
+ setIsPopoverOpen: setIsPopoverOpen,
145
+ setIsColumnMoving: setIsColumnMoving,
146
+ setFocusedCell: setFocusedCell,
147
+ columnFocusIndex: index
148
+ });
149
+ }, [column, columns, schema, schemaDetectors, setVisibleColumns, focusFirstVisibleInteractiveCell, sorting, switchColumnPos, setFocusedCell, index]);
150
+
151
+ /**
152
+ * Rendering
153
+ */
154
+ var styles = (0, _services.useEuiMemoizedStyles)(_data_grid_header_cell.euiDataGridHeaderCellStyles);
155
+ return (0, _react2.jsx)(_popover.EuiPopover, _extends({
156
+ display: "block",
157
+ panelPaddingSize: "none",
158
+ offset: 7,
159
+ anchorPosition: "downRight",
160
+ css: styles.euiDataGridHeaderCell__popover,
161
+ button: (0, _react2.jsx)(_button.EuiButtonIcon, {
162
+ iconType: "boxesVertical",
163
+ iconSize: "s",
164
+ color: "text",
165
+ css: styles.euiDataGridHeaderCell__actions,
166
+ className: "euiDataGridHeaderCell__button",
167
+ onClick: togglePopover,
168
+ buttonRef: actionsButtonRef,
169
+ onFocus: onFocus,
170
+ onBlur: onBlur,
171
+ tabIndex: 0 // Override EuiButtonIcon's conditional tabindex based on aria-hidden
172
+ ,
173
+ "aria-hidden": hasFocusTrap && !isActionsButtonFocused ? 'true' // prevent the actions button from being read on cell focus
174
+ : undefined,
175
+ "aria-label": hasFocusTrap ? actionsButtonAriaLabel : actionsEnterKeyInstructions,
176
+ "data-test-subj": "dataGridHeaderCellActionButton-".concat(id)
177
+ }),
178
+ isOpen: isPopoverOpen,
179
+ closePopover: closePopover
180
+ }, popoverArrowNavigationProps), (0, _react2.jsx)(_list_group.EuiListGroup, {
181
+ listItems: columnActions,
182
+ gutterSize: "none",
183
+ "data-test-subj": "dataGridHeaderCellActionGroup-".concat(id)
184
+ }));
185
+ });
186
+ ColumnActions.propTypes = {
187
+ id: _propTypes.default.string.isRequired,
188
+ title: _propTypes.default.string.isRequired,
189
+ hasFocusTrap: _propTypes.default.bool.isRequired,
190
+ setPropsFromColumnActions: _propTypes.default.func.isRequired,
191
+ actionsButtonRef: _propTypes.default.any.isRequired
192
+ };
193
+ ColumnActions.displayName = 'EuiDataGridHeaderCellColumnActions';
194
+
195
+ /**
196
+ * Add keyboard arrow navigation to the cell actions popover
197
+ * to match the UX of the rest of EuiDataGrid
198
+ */
199
+ var usePopoverArrowNavigation = exports.usePopoverArrowNavigation = function usePopoverArrowNavigation() {
200
+ var popoverPanelRef = (0, _react.useRef)(null);
201
+ var actionsRef = (0, _react.useRef)(undefined);
202
+ var panelRef = (0, _react.useCallback)(function (ref) {
203
+ popoverPanelRef.current = ref;
204
+ actionsRef.current = ref ? (0, _tabbable.tabbable)(ref) : undefined;
205
+ }, []);
206
+ var onKeyDown = (0, _react.useCallback)(function (e) {
207
+ var _actionsRef$current;
208
+ if (e.key !== _services.keys.ARROW_DOWN && e.key !== _services.keys.ARROW_UP) return;
209
+ if (!((_actionsRef$current = actionsRef.current) !== null && _actionsRef$current !== void 0 && _actionsRef$current.length)) return;
210
+ e.preventDefault();
211
+ var initialState = document.activeElement === popoverPanelRef.current;
212
+ var currentIndex = !initialState ? actionsRef.current.findIndex(function (el) {
213
+ return document.activeElement === el;
214
+ }) : -1;
215
+ var lastIndex = actionsRef.current.length - 1;
216
+ var indexToFocus;
217
+ if (initialState) {
218
+ if (e.key === _services.keys.ARROW_DOWN) {
219
+ indexToFocus = 0;
220
+ } else if (e.key === _services.keys.ARROW_UP) {
221
+ indexToFocus = lastIndex;
222
+ }
223
+ } else {
224
+ if (e.key === _services.keys.ARROW_DOWN) {
225
+ indexToFocus = currentIndex + 1;
226
+ if (indexToFocus > lastIndex) {
227
+ indexToFocus = 0;
228
+ }
229
+ } else if (e.key === _services.keys.ARROW_UP) {
230
+ indexToFocus = currentIndex - 1;
231
+ if (indexToFocus < 0) {
232
+ indexToFocus = lastIndex;
233
+ }
234
+ }
235
+ }
236
+ actionsRef.current[indexToFocus].focus();
237
+ }, []);
238
+ return {
239
+ panelRef: panelRef,
240
+ panelProps: {
241
+ onKeyDown: onKeyDown
242
+ },
243
+ popoverScreenReaderText: (0, _react2.jsx)(_i18n.EuiI18n, {
244
+ token: "euiDataGridHeaderCell.actionsPopoverScreenReaderText",
245
+ default: "To navigate through the list of column actions, press the Tab or Up and Down arrow keys."
246
+ })
247
+ };
248
+ };
249
+
250
+ /**
251
+ * Logic for returning an array of actions/items to pass to EuiListGroup
252
+ */
253
+
254
+ var getColumnActions = exports.getColumnActions = function getColumnActions(_ref2) {
255
+ var _column$actions;
256
+ var column = _ref2.column,
257
+ columns = _ref2.columns,
258
+ schema = _ref2.schema,
259
+ schemaDetectors = _ref2.schemaDetectors,
260
+ setVisibleColumns = _ref2.setVisibleColumns,
261
+ focusFirstVisibleInteractiveCell = _ref2.focusFirstVisibleInteractiveCell,
262
+ setIsPopoverOpen = _ref2.setIsPopoverOpen,
263
+ sorting = _ref2.sorting,
264
+ switchColumnPos = _ref2.switchColumnPos,
265
+ setIsColumnMoving = _ref2.setIsColumnMoving,
266
+ setFocusedCell = _ref2.setFocusedCell,
267
+ columnFocusIndex = _ref2.columnFocusIndex;
44
268
  if (column.actions === false) {
45
269
  return [];
46
270
  }
@@ -58,6 +282,7 @@ var getColumnActions = exports.getColumnActions = function getColumnActions(_ref
58
282
  column: column,
59
283
  columns: columns,
60
284
  switchColumnPos: switchColumnPos,
285
+ setIsColumnMoving: setIsColumnMoving,
61
286
  setFocusedCell: setFocusedCell,
62
287
  columnFocusIndex: columnFocusIndex
63
288
  })), _toConsumableArray(((_column$actions = column.actions) === null || _column$actions === void 0 ? void 0 : _column$actions.additional) || []));
@@ -79,11 +304,11 @@ var getColumnActions = exports.getColumnActions = function getColumnActions(_ref
79
304
  * Hide column action
80
305
  */
81
306
 
82
- var getHideColumnAction = exports.getHideColumnAction = function getHideColumnAction(_ref2) {
83
- var column = _ref2.column,
84
- columns = _ref2.columns,
85
- setVisibleColumns = _ref2.setVisibleColumns,
86
- focusFirstVisibleInteractiveCell = _ref2.focusFirstVisibleInteractiveCell;
307
+ var getHideColumnAction = exports.getHideColumnAction = function getHideColumnAction(_ref3) {
308
+ var column = _ref3.column,
309
+ columns = _ref3.columns,
310
+ setVisibleColumns = _ref3.setVisibleColumns,
311
+ focusFirstVisibleInteractiveCell = _ref3.focusFirstVisibleInteractiveCell;
87
312
  var items = [];
88
313
  var onClickHideColumn = function onClickHideColumn() {
89
314
  setVisibleColumns(columns.filter(function (col) {
@@ -114,16 +339,25 @@ var getHideColumnAction = exports.getHideColumnAction = function getHideColumnAc
114
339
  * Move column actions
115
340
  */
116
341
 
117
- var getMoveColumnActions = function getMoveColumnActions(_ref3) {
118
- var column = _ref3.column,
119
- columns = _ref3.columns,
120
- switchColumnPos = _ref3.switchColumnPos,
121
- setFocusedCell = _ref3.setFocusedCell,
122
- columnFocusIndex = _ref3.columnFocusIndex;
342
+ var getMoveColumnActions = function getMoveColumnActions(_ref4) {
343
+ var column = _ref4.column,
344
+ columns = _ref4.columns,
345
+ switchColumnPos = _ref4.switchColumnPos,
346
+ setIsColumnMoving = _ref4.setIsColumnMoving,
347
+ setFocusedCell = _ref4.setFocusedCell,
348
+ columnFocusIndex = _ref4.columnFocusIndex;
123
349
  var items = [];
124
350
  var colIdx = columns.findIndex(function (col) {
125
351
  return col.id === column.id;
126
352
  });
353
+
354
+ // UX polish: prevent the column actions hover animation from flashing after column move
355
+ var handleAnimationFlash = function handleAnimationFlash() {
356
+ setIsColumnMoving(true);
357
+ requestAnimationFrame(function () {
358
+ return setIsColumnMoving(false);
359
+ });
360
+ };
127
361
  var moveFocus = function moveFocus(direction) {
128
362
  var newIndex = direction === 'left' ? -1 : 1;
129
363
  // Wait a beat to move focus, otherwise the EuiPopover's EuiFocusTrap's
@@ -137,6 +371,7 @@ var getMoveColumnActions = function getMoveColumnActions(_ref3) {
137
371
  var targetCol = columns[colIdx - 1];
138
372
  if (targetCol) {
139
373
  switchColumnPos(column.id, targetCol.id);
374
+ handleAnimationFlash();
140
375
  moveFocus('left');
141
376
  }
142
377
  };
@@ -158,6 +393,7 @@ var getMoveColumnActions = function getMoveColumnActions(_ref3) {
158
393
  var targetCol = columns[colIdx + 1];
159
394
  if (targetCol) {
160
395
  switchColumnPos(column.id, targetCol.id);
396
+ handleAnimationFlash();
161
397
  moveFocus('right');
162
398
  }
163
399
  };
@@ -181,11 +417,11 @@ var getMoveColumnActions = function getMoveColumnActions(_ref3) {
181
417
  * Sort column actions
182
418
  */
183
419
 
184
- var getSortColumnActions = exports.getSortColumnActions = function getSortColumnActions(_ref4) {
185
- var column = _ref4.column,
186
- sorting = _ref4.sorting,
187
- schema = _ref4.schema,
188
- schemaDetectors = _ref4.schemaDetectors;
420
+ var getSortColumnActions = exports.getSortColumnActions = function getSortColumnActions(_ref5) {
421
+ var column = _ref5.column,
422
+ sorting = _ref5.sorting,
423
+ schema = _ref5.schema,
424
+ schemaDetectors = _ref5.schemaDetectors;
189
425
  if (!sorting) return [];
190
426
  var items = [];
191
427
  var sortingIdx = sorting.columns.findIndex(function (col) {
@@ -8,7 +8,8 @@ var _react = _interopRequireWildcard(require("react"));
8
8
  var _propTypes = _interopRequireDefault(require("prop-types"));
9
9
  var _services = require("../../../../services");
10
10
  var _global_styling = require("../../../../global_styling");
11
- var _data_grid_column_resizer = require("./data_grid_column_resizer.styles");
11
+ var _draggable_columns = require("./draggable_columns");
12
+ var _column_resizer = require("./column_resizer.styles");
12
13
  var _react2 = require("@emotion/react");
13
14
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
14
15
  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); }
@@ -88,16 +89,20 @@ var EuiDataGridColumnResizer = exports.EuiDataGridColumnResizer = /*#__PURE__*/f
88
89
  value: function render() {
89
90
  var _this2 = this;
90
91
  var offset = this.state.offset;
92
+ var isLastColumn = this.props.isLastColumn;
91
93
  return (0, _react2.jsx)(_services.RenderWithEuiStylesMemoizer, null, function (stylesMemoizer) {
92
- var styles = stylesMemoizer(_data_grid_column_resizer.euiDataGridColumnResizerStyles);
93
- var cssStyles = [styles.euiDataGridColumnResizer, offset && styles.isDragging];
94
+ var styles = stylesMemoizer(_column_resizer.euiDataGridColumnResizerStyles);
95
+ var cssStyles = [styles.euiDataGridColumnResizer, isLastColumn && styles.isLastColumn, offset && styles.isDragging];
94
96
  return (0, _react2.jsx)("div", {
95
97
  css: cssStyles,
96
98
  className: "euiDataGridColumnResizer",
97
99
  "data-test-subj": "dataGridColumnResizer",
98
100
  style: offset ? (0, _global_styling.logicalStyle)('margin-right', "".concat(-offset, "px")) : undefined,
99
101
  onMouseDown: _this2.onMouseDown
100
- });
102
+ }, (0, _react2.jsx)(_draggable_columns.DragOverlay, {
103
+ isDragging: !!offset,
104
+ cursor: "ew-resize"
105
+ }));
101
106
  });
102
107
  }
103
108
  }]);
@@ -105,5 +110,6 @@ var EuiDataGridColumnResizer = exports.EuiDataGridColumnResizer = /*#__PURE__*/f
105
110
  EuiDataGridColumnResizer.propTypes = {
106
111
  columnId: _propTypes.default.string.isRequired,
107
112
  columnWidth: _propTypes.default.number.isRequired,
108
- setColumnWidth: _propTypes.default.func.isRequired
113
+ setColumnWidth: _propTypes.default.func.isRequired,
114
+ isLastColumn: _propTypes.default.bool.isRequired
109
115
  };
@@ -33,7 +33,12 @@ var euiDataGridColumnResizerStyles = exports.euiDataGridColumnResizerStyles = fu
33
33
  }); // Odd number because it straddles a border
34
34
  var indicatorOffset = "-".concat(euiTheme.border.width.thin);
35
35
  return {
36
- euiDataGridColumnResizer: /*#__PURE__*/(0, _react.css)("z-index:2;position:absolute;", (0, _global_styling.logicalCSS)('vertical', 0), " ", (0, _global_styling.logicalCSS)('right', positionOffset), " cursor:ew-resize;opacity:0;&:hover,&:active{opacity:1;}&::after{content:'';position:absolute;", (0, _global_styling.logicalCSS)('vertical', 0), " ", (0, _global_styling.logicalCSS)('left', positionOffset), " ", (0, _global_styling.logicalCSS)('margin-left', indicatorOffset), " ", (0, _global_styling.logicalCSS)('width', indicatorWidth), " background-color:", euiTheme.colors.primary, ";}.euiDataGridHeaderCell:last-child &{", (0, _global_styling.logicalCSS)('right', 0), " ", (0, _global_styling.logicalCSS)('width', euiTheme.size.s), " &::after{", (0, _global_styling.logicalCSS)('left', 'auto'), " ", (0, _global_styling.logicalCSS)('right', 0), ";}};label:euiDataGridColumnResizer;"),
36
+ euiDataGridColumnResizer: /*#__PURE__*/(0, _react.css)("z-index:2;position:absolute;", (0, _global_styling.logicalCSS)('vertical', 0), " ", (0, _global_styling.logicalCSS)('right', positionOffset), " cursor:ew-resize;opacity:0;&:hover,&:active{opacity:1;}&::after{content:'';position:absolute;", (0, _global_styling.logicalCSS)('vertical', 0), " ", (0, _global_styling.logicalCSS)('left', positionOffset), " ", (0, _global_styling.logicalCSS)('margin-left', indicatorOffset), " ", (0, _global_styling.logicalCSS)('width', indicatorWidth), " background-color:", euiTheme.colors.primary, ";};label:euiDataGridColumnResizer;"),
37
+ /* Because the resizer sits in the negative space to the right of the column,
38
+ * it can cause the full grid to be a few pixels longer than it actually is.
39
+ * So for the last cell, we don't use negative positioning and the borders from
40
+ * the cell will match the container. */
41
+ isLastColumn: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('right', 0), " ", (0, _global_styling.logicalCSS)('width', euiTheme.size.s), " &::after{", (0, _global_styling.logicalCSS)('left', 'auto'), " ", (0, _global_styling.logicalCSS)('right', 0), ";};label:isLastColumn;"),
37
42
  isDragging: _ref
38
43
  };
39
44
  };