@elastic/eui 93.3.0 → 93.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/eui_charts_theme.d.ts +9 -0
- package/dist/eui_charts_theme.js +56 -14
- package/dist/eui_charts_theme.js.map +1 -1
- package/es/components/breadcrumbs/_breadcrumb_content.js +362 -0
- package/es/components/breadcrumbs/_breadcrumb_content.styles.js +48 -0
- package/es/components/breadcrumbs/breadcrumb.js +10 -327
- package/es/components/breadcrumbs/breadcrumb.styles.js +5 -27
- package/es/components/breadcrumbs/breadcrumbs.js +4 -4
- package/es/components/breadcrumbs/types.js +1 -0
- package/es/components/button/button_group/button_group.js +16 -2
- package/es/components/button/button_group/button_group.styles.js +1 -1
- package/es/components/button/button_group/button_group_button.js +59 -5
- package/es/components/button/button_group/button_group_button.styles.js +39 -3
- package/es/components/datagrid/body/cell/data_grid_cell.js +97 -58
- package/es/components/datagrid/body/cell/data_grid_cell_actions.js +24 -18
- package/es/components/datagrid/body/cell/data_grid_cell_popover.js +64 -56
- package/es/components/datagrid/body/cell/data_grid_cell_wrapper.js +32 -31
- package/es/components/datagrid/body/cell/index.js +1 -1
- package/es/components/datagrid/body/data_grid_body.js +13 -0
- package/es/components/datagrid/body/data_grid_body_custom.js +52 -36
- package/es/components/datagrid/body/data_grid_body_virtualized.js +84 -56
- package/es/components/datagrid/body/data_grid_row_manager.js +6 -4
- package/es/components/datagrid/body/footer/use_data_grid_footer.js +1 -2
- package/es/components/datagrid/body/header/data_grid_control_header_cell.js +5 -4
- package/es/components/datagrid/body/header/data_grid_header_cell.js +73 -53
- package/es/components/datagrid/body/header/data_grid_header_row.js +15 -551
- package/es/components/datagrid/body/header/use_data_grid_header.js +7 -6
- package/es/components/datagrid/controls/column_selector.js +126 -123
- package/es/components/datagrid/controls/column_sorting.js +605 -103
- package/es/components/datagrid/controls/column_sorting_draggable.js +24 -22
- package/es/components/datagrid/controls/display_selector.js +109 -107
- package/es/components/datagrid/data_grid.a11y.js +13 -12
- package/es/components/datagrid/data_grid.js +45 -22
- package/es/components/datagrid/utils/col_widths.js +12 -8
- package/es/components/datagrid/utils/focus.js +10 -8
- package/es/components/datagrid/utils/grid_height_width.js +31 -30
- package/es/components/datagrid/utils/ref.js +1 -1
- package/es/components/datagrid/utils/row_heights.js +2 -2
- package/es/components/datagrid/utils/sorting.js +29 -27
- package/es/components/date_picker/super_date_picker/super_date_picker.js +9 -0
- package/es/components/date_picker/super_date_picker/super_update_button.js +57 -29
- package/es/components/flex/flex_grid.js +22 -8
- package/es/components/flex/flex_grid.styles.js +13 -6
- package/es/components/flex/flex_group.js +10 -11
- package/es/components/flex/flex_item.js +9 -11
- package/es/components/flex/flex_item.styles.js +107 -122
- package/es/components/flyout/flyout.js +16 -18
- package/es/components/header/header_breadcrumbs/header_breadcrumbs.js +3 -5
- package/es/components/modal/confirm_modal.js +2 -1
- package/es/components/modal/modal.js +12 -3
- package/es/components/observer/resize_observer/resize_observer.js +15 -24
- package/es/components/spacer/spacer.js +2 -3
- package/es/components/toast/global_toast_list.js +70 -73
- package/es/components/toast/toast.js +27 -42
- package/es/components/toast/toast.styles.js +2 -17
- package/es/services/color/eui_palettes.js +21 -13
- package/es/services/color/index.js +1 -1
- package/es/services/hooks/index.js +1 -0
- package/es/services/hooks/useDeepEqual.js +23 -0
- package/es/services/index.js +1 -1
- package/eui.d.ts +2442 -2337
- package/i18ntokens.json +259 -259
- package/lib/components/breadcrumbs/_breadcrumb_content.js +372 -0
- package/lib/components/breadcrumbs/_breadcrumb_content.styles.js +55 -0
- package/lib/components/breadcrumbs/breadcrumb.js +11 -331
- package/lib/components/breadcrumbs/breadcrumb.styles.js +5 -29
- package/lib/components/breadcrumbs/breadcrumbs.js +3 -3
- package/lib/components/breadcrumbs/types.js +5 -0
- package/lib/components/button/button_group/button_group.js +16 -2
- package/lib/components/button/button_group/button_group.styles.js +1 -1
- package/lib/components/button/button_group/button_group_button.js +59 -5
- package/lib/components/button/button_group/button_group_button.styles.js +45 -11
- package/lib/components/datagrid/body/cell/data_grid_cell.js +95 -57
- package/lib/components/datagrid/body/cell/data_grid_cell_actions.js +24 -18
- package/lib/components/datagrid/body/cell/data_grid_cell_popover.js +63 -55
- package/lib/components/datagrid/body/cell/data_grid_cell_wrapper.js +32 -31
- package/lib/components/datagrid/body/cell/index.js +2 -2
- package/lib/components/datagrid/body/data_grid_body.js +13 -0
- package/lib/components/datagrid/body/data_grid_body_custom.js +51 -35
- package/lib/components/datagrid/body/data_grid_body_virtualized.js +83 -55
- package/lib/components/datagrid/body/data_grid_row_manager.js +5 -3
- package/lib/components/datagrid/body/footer/use_data_grid_footer.js +1 -2
- package/lib/components/datagrid/body/header/data_grid_control_header_cell.js +8 -4
- package/lib/components/datagrid/body/header/data_grid_header_cell.js +72 -52
- package/lib/components/datagrid/body/header/data_grid_header_row.js +14 -550
- package/lib/components/datagrid/body/header/use_data_grid_header.js +7 -6
- package/lib/components/datagrid/controls/column_selector.js +126 -123
- package/lib/components/datagrid/controls/column_sorting.js +615 -110
- package/lib/components/datagrid/controls/column_sorting_draggable.js +27 -22
- package/lib/components/datagrid/controls/display_selector.js +109 -107
- package/lib/components/datagrid/data_grid.a11y.js +13 -12
- package/lib/components/datagrid/data_grid.js +43 -20
- package/lib/components/datagrid/utils/col_widths.js +12 -8
- package/lib/components/datagrid/utils/focus.js +10 -8
- package/lib/components/datagrid/utils/grid_height_width.js +29 -28
- package/lib/components/datagrid/utils/ref.js +1 -1
- package/lib/components/datagrid/utils/row_heights.js +1 -1
- package/lib/components/datagrid/utils/sorting.js +31 -29
- package/lib/components/date_picker/super_date_picker/super_date_picker.js +9 -0
- package/lib/components/date_picker/super_date_picker/super_update_button.js +57 -29
- package/lib/components/flex/flex_grid.js +23 -7
- package/lib/components/flex/flex_grid.styles.js +13 -6
- package/lib/components/flex/flex_group.js +10 -10
- package/lib/components/flex/flex_item.js +13 -13
- package/lib/components/flex/flex_item.styles.js +107 -122
- package/lib/components/flyout/flyout.js +16 -18
- package/lib/components/header/header_breadcrumbs/header_breadcrumbs.js +3 -5
- package/lib/components/modal/confirm_modal.js +2 -1
- package/lib/components/modal/modal.js +12 -3
- package/lib/components/observer/resize_observer/resize_observer.js +15 -24
- package/lib/components/spacer/spacer.js +1 -2
- package/lib/components/toast/global_toast_list.js +68 -71
- package/lib/components/toast/toast.js +25 -40
- package/lib/components/toast/toast.styles.js +11 -25
- package/lib/services/color/eui_palettes.js +24 -14
- package/lib/services/color/index.js +14 -0
- package/lib/services/hooks/index.js +11 -0
- package/lib/services/hooks/useDeepEqual.js +30 -0
- package/lib/services/index.js +15 -1
- package/optimize/es/components/breadcrumbs/_breadcrumb_content.js +153 -0
- package/optimize/es/components/breadcrumbs/_breadcrumb_content.styles.js +48 -0
- package/optimize/es/components/breadcrumbs/breadcrumb.js +10 -110
- package/optimize/es/components/breadcrumbs/breadcrumb.styles.js +5 -27
- package/optimize/es/components/breadcrumbs/breadcrumbs.js +4 -4
- package/optimize/es/components/breadcrumbs/types.js +1 -0
- package/optimize/es/components/button/button_group/button_group.js +2 -2
- package/optimize/es/components/button/button_group/button_group.styles.js +1 -1
- package/optimize/es/components/button/button_group/button_group_button.js +36 -4
- package/optimize/es/components/button/button_group/button_group_button.styles.js +39 -3
- package/optimize/es/components/datagrid/body/cell/data_grid_cell.js +80 -55
- package/optimize/es/components/datagrid/body/cell/data_grid_cell_actions.js +24 -18
- package/optimize/es/components/datagrid/body/cell/data_grid_cell_popover.js +64 -56
- package/optimize/es/components/datagrid/body/cell/data_grid_cell_wrapper.js +32 -31
- package/optimize/es/components/datagrid/body/cell/index.js +1 -1
- package/optimize/es/components/datagrid/body/data_grid_body_custom.js +39 -36
- package/optimize/es/components/datagrid/body/data_grid_body_virtualized.js +69 -49
- package/optimize/es/components/datagrid/body/data_grid_row_manager.js +6 -4
- package/optimize/es/components/datagrid/body/footer/use_data_grid_footer.js +1 -2
- package/optimize/es/components/datagrid/body/header/data_grid_control_header_cell.js +4 -3
- package/optimize/es/components/datagrid/body/header/data_grid_header_cell.js +65 -49
- package/optimize/es/components/datagrid/body/header/data_grid_header_row.js +15 -13
- package/optimize/es/components/datagrid/body/header/use_data_grid_header.js +7 -6
- package/optimize/es/components/datagrid/controls/column_selector.js +126 -123
- package/optimize/es/components/datagrid/controls/column_sorting.js +121 -103
- package/optimize/es/components/datagrid/controls/column_sorting_draggable.js +24 -22
- package/optimize/es/components/datagrid/controls/display_selector.js +109 -107
- package/optimize/es/components/datagrid/data_grid.a11y.js +13 -12
- package/optimize/es/components/datagrid/data_grid.js +45 -22
- package/optimize/es/components/datagrid/utils/col_widths.js +9 -5
- package/optimize/es/components/datagrid/utils/focus.js +10 -8
- package/optimize/es/components/datagrid/utils/grid_height_width.js +31 -30
- package/optimize/es/components/datagrid/utils/ref.js +1 -1
- package/optimize/es/components/datagrid/utils/row_heights.js +2 -2
- package/optimize/es/components/datagrid/utils/sorting.js +29 -27
- package/optimize/es/components/date_picker/super_date_picker/super_update_button.js +49 -29
- package/optimize/es/components/flex/flex_grid.js +19 -8
- package/optimize/es/components/flex/flex_grid.styles.js +13 -6
- package/optimize/es/components/flex/flex_group.js +9 -10
- package/optimize/es/components/flex/flex_item.js +9 -11
- package/optimize/es/components/flex/flex_item.styles.js +107 -122
- package/optimize/es/components/flyout/flyout.js +16 -18
- package/optimize/es/components/header/header_breadcrumbs/header_breadcrumbs.js +3 -5
- package/optimize/es/components/modal/confirm_modal.js +2 -1
- package/optimize/es/components/modal/modal.js +6 -2
- package/optimize/es/components/observer/resize_observer/resize_observer.js +15 -24
- package/optimize/es/components/spacer/spacer.js +2 -3
- package/optimize/es/components/toast/global_toast_list.js +70 -73
- package/optimize/es/components/toast/toast.js +27 -42
- package/optimize/es/components/toast/toast.styles.js +2 -17
- package/optimize/es/services/color/eui_palettes.js +21 -13
- package/optimize/es/services/color/index.js +1 -1
- package/optimize/es/services/hooks/index.js +1 -0
- package/optimize/es/services/hooks/useDeepEqual.js +23 -0
- package/optimize/es/services/index.js +1 -1
- package/optimize/lib/components/breadcrumbs/_breadcrumb_content.js +163 -0
- package/optimize/lib/components/breadcrumbs/_breadcrumb_content.styles.js +55 -0
- package/optimize/lib/components/breadcrumbs/breadcrumb.js +10 -113
- package/optimize/lib/components/breadcrumbs/breadcrumb.styles.js +5 -29
- package/optimize/lib/components/breadcrumbs/breadcrumbs.js +3 -3
- package/optimize/lib/components/breadcrumbs/types.js +5 -0
- package/optimize/lib/components/button/button_group/button_group.js +2 -2
- package/optimize/lib/components/button/button_group/button_group.styles.js +1 -1
- package/optimize/lib/components/button/button_group/button_group_button.js +37 -5
- package/optimize/lib/components/button/button_group/button_group_button.styles.js +45 -11
- package/optimize/lib/components/datagrid/body/cell/data_grid_cell.js +78 -54
- package/optimize/lib/components/datagrid/body/cell/data_grid_cell_actions.js +24 -18
- package/optimize/lib/components/datagrid/body/cell/data_grid_cell_popover.js +63 -55
- package/optimize/lib/components/datagrid/body/cell/data_grid_cell_wrapper.js +32 -31
- package/optimize/lib/components/datagrid/body/cell/index.js +2 -2
- package/optimize/lib/components/datagrid/body/data_grid_body_custom.js +38 -35
- package/optimize/lib/components/datagrid/body/data_grid_body_virtualized.js +70 -50
- package/optimize/lib/components/datagrid/body/data_grid_row_manager.js +5 -3
- package/optimize/lib/components/datagrid/body/footer/use_data_grid_footer.js +1 -2
- package/optimize/lib/components/datagrid/body/header/data_grid_control_header_cell.js +8 -4
- package/optimize/lib/components/datagrid/body/header/data_grid_header_cell.js +65 -49
- package/optimize/lib/components/datagrid/body/header/data_grid_header_row.js +14 -12
- package/optimize/lib/components/datagrid/body/header/use_data_grid_header.js +7 -6
- package/optimize/lib/components/datagrid/controls/column_selector.js +126 -123
- package/optimize/lib/components/datagrid/controls/column_sorting.js +125 -107
- package/optimize/lib/components/datagrid/controls/column_sorting_draggable.js +27 -22
- package/optimize/lib/components/datagrid/controls/display_selector.js +109 -107
- package/optimize/lib/components/datagrid/data_grid.a11y.js +13 -12
- package/optimize/lib/components/datagrid/data_grid.js +43 -20
- package/optimize/lib/components/datagrid/utils/col_widths.js +9 -5
- package/optimize/lib/components/datagrid/utils/focus.js +10 -8
- package/optimize/lib/components/datagrid/utils/grid_height_width.js +29 -28
- package/optimize/lib/components/datagrid/utils/ref.js +1 -1
- package/optimize/lib/components/datagrid/utils/row_heights.js +1 -1
- package/optimize/lib/components/datagrid/utils/sorting.js +31 -29
- package/optimize/lib/components/date_picker/super_date_picker/super_update_button.js +49 -29
- package/optimize/lib/components/flex/flex_grid.js +21 -7
- package/optimize/lib/components/flex/flex_grid.styles.js +13 -6
- package/optimize/lib/components/flex/flex_group.js +9 -9
- package/optimize/lib/components/flex/flex_item.js +13 -13
- package/optimize/lib/components/flex/flex_item.styles.js +107 -122
- package/optimize/lib/components/flyout/flyout.js +16 -18
- package/optimize/lib/components/header/header_breadcrumbs/header_breadcrumbs.js +3 -5
- package/optimize/lib/components/modal/confirm_modal.js +2 -1
- package/optimize/lib/components/modal/modal.js +6 -2
- package/optimize/lib/components/observer/resize_observer/resize_observer.js +15 -24
- package/optimize/lib/components/spacer/spacer.js +1 -2
- package/optimize/lib/components/toast/global_toast_list.js +68 -71
- package/optimize/lib/components/toast/toast.js +25 -40
- package/optimize/lib/components/toast/toast.styles.js +11 -25
- package/optimize/lib/services/color/eui_palettes.js +24 -14
- package/optimize/lib/services/color/index.js +14 -0
- package/optimize/lib/services/hooks/index.js +11 -0
- package/optimize/lib/services/hooks/useDeepEqual.js +30 -0
- package/optimize/lib/services/index.js +15 -1
- package/package.json +2 -2
- package/test-env/components/breadcrumbs/_breadcrumb_content.js +363 -0
- package/test-env/components/breadcrumbs/_breadcrumb_content.styles.js +55 -0
- package/test-env/components/breadcrumbs/breadcrumb.js +11 -326
- package/test-env/components/breadcrumbs/breadcrumb.styles.js +5 -29
- package/test-env/components/breadcrumbs/breadcrumbs.js +3 -3
- package/test-env/components/breadcrumbs/types.js +5 -0
- package/test-env/components/button/button_group/button_group.js +16 -2
- package/test-env/components/button/button_group/button_group.styles.js +1 -1
- package/test-env/components/button/button_group/button_group_button.js +56 -5
- package/test-env/components/button/button_group/button_group_button.styles.js +45 -11
- package/test-env/components/datagrid/body/cell/data_grid_cell.js +95 -57
- package/test-env/components/datagrid/body/cell/data_grid_cell_actions.js +24 -18
- package/test-env/components/datagrid/body/cell/data_grid_cell_popover.js +63 -55
- package/test-env/components/datagrid/body/cell/data_grid_cell_wrapper.js +32 -31
- package/test-env/components/datagrid/body/cell/index.js +2 -2
- package/test-env/components/datagrid/body/data_grid_body.js +13 -0
- package/test-env/components/datagrid/body/data_grid_body_custom.js +51 -35
- package/test-env/components/datagrid/body/data_grid_body_virtualized.js +83 -55
- package/test-env/components/datagrid/body/data_grid_row_manager.js +5 -3
- package/test-env/components/datagrid/body/footer/use_data_grid_footer.js +1 -2
- package/test-env/components/datagrid/body/header/data_grid_control_header_cell.js +8 -4
- package/test-env/components/datagrid/body/header/data_grid_header_cell.js +72 -52
- package/test-env/components/datagrid/body/header/data_grid_header_row.js +14 -550
- package/test-env/components/datagrid/body/header/use_data_grid_header.js +7 -6
- package/test-env/components/datagrid/controls/column_selector.js +126 -123
- package/test-env/components/datagrid/controls/column_sorting.js +607 -106
- package/test-env/components/datagrid/controls/column_sorting_draggable.js +27 -22
- package/test-env/components/datagrid/controls/display_selector.js +109 -107
- package/test-env/components/datagrid/data_grid.a11y.js +13 -12
- package/test-env/components/datagrid/data_grid.js +43 -20
- package/test-env/components/datagrid/utils/col_widths.js +9 -5
- package/test-env/components/datagrid/utils/focus.js +10 -8
- package/test-env/components/datagrid/utils/grid_height_width.js +29 -28
- package/test-env/components/datagrid/utils/ref.js +1 -1
- package/test-env/components/datagrid/utils/row_heights.js +1 -1
- package/test-env/components/datagrid/utils/sorting.js +31 -29
- package/test-env/components/date_picker/super_date_picker/super_date_picker.js +9 -0
- package/test-env/components/date_picker/super_date_picker/super_update_button.js +57 -29
- package/test-env/components/flex/flex_grid.js +21 -7
- package/test-env/components/flex/flex_grid.styles.js +13 -6
- package/test-env/components/flex/flex_group.js +10 -10
- package/test-env/components/flex/flex_item.js +13 -13
- package/test-env/components/flex/flex_item.styles.js +107 -122
- package/test-env/components/header/header_breadcrumbs/header_breadcrumbs.js +3 -5
- package/test-env/components/modal/confirm_modal.js +2 -1
- package/test-env/components/modal/modal.js +12 -3
- package/test-env/components/spacer/spacer.js +1 -2
- package/test-env/components/toast/global_toast_list.js +68 -71
- package/test-env/components/toast/toast.js +25 -40
- package/test-env/components/toast/toast.styles.js +11 -25
- package/test-env/services/color/eui_palettes.js +24 -14
- package/test-env/services/color/index.js +14 -0
- package/test-env/services/hooks/index.js +11 -0
- package/test-env/services/hooks/useDeepEqual.js +30 -0
- package/test-env/services/index.js +15 -1
- package/src/themes/charts/theme.scss +0 -5
|
@@ -3,11 +3,12 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.EuiDataGridBodyVirtualized = exports.DataGridWrapperRowsContext = exports.Cell = void 0;
|
|
7
7
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
8
8
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
9
9
|
var _react = _interopRequireWildcard(require("react"));
|
|
10
10
|
var _reactWindow = require("react-window");
|
|
11
|
+
var _services = require("../../../services");
|
|
11
12
|
var _resize_observer = require("../../observer/resize_observer");
|
|
12
13
|
var _header = require("./header");
|
|
13
14
|
var _footer = require("./footer");
|
|
@@ -38,53 +39,56 @@ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input ==
|
|
|
38
39
|
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
39
40
|
* Side Public License, v 1.
|
|
40
41
|
*/
|
|
41
|
-
var
|
|
42
|
+
var Cell = /*#__PURE__*/(0, _react.memo)(function (_ref) {
|
|
42
43
|
var columnIndex = _ref.columnIndex,
|
|
43
44
|
rowIndex = _ref.rowIndex,
|
|
44
45
|
style = _ref.style,
|
|
45
46
|
data = _ref.data;
|
|
46
|
-
var
|
|
47
|
-
|
|
48
|
-
|
|
47
|
+
var memoizedStyles = (0, _services.useDeepEqual)(style);
|
|
48
|
+
var cellStyles = (0, _react.useMemo)(function () {
|
|
49
|
+
var headerRowHeight = data.headerRowHeight;
|
|
50
|
+
return _objectSpread(_objectSpread({}, memoizedStyles), {}, {
|
|
51
|
+
top: "".concat(parseFloat(memoizedStyles.top) + headerRowHeight, "px")
|
|
52
|
+
});
|
|
53
|
+
}, [memoizedStyles, data]);
|
|
54
|
+
return (0, _react2.jsx)(_cell.CellWrapper, _extends({
|
|
49
55
|
colIndex: columnIndex,
|
|
50
56
|
visibleRowIndex: rowIndex,
|
|
51
|
-
style:
|
|
52
|
-
top: "".concat(parseFloat(style.top) + headerRowHeight, "px")
|
|
53
|
-
})
|
|
57
|
+
style: cellStyles
|
|
54
58
|
}, data));
|
|
55
|
-
};
|
|
59
|
+
});
|
|
60
|
+
exports.Cell = Cell;
|
|
61
|
+
Cell.displayName = 'Cell';
|
|
56
62
|
|
|
57
63
|
// Context is required to pass props to react-window's innerElementType
|
|
58
64
|
// @see https://github.com/bvaughn/react-window/issues/404
|
|
59
|
-
exports._Cell = _Cell;
|
|
60
65
|
var DataGridWrapperRowsContext = /*#__PURE__*/(0, _react.createContext)({
|
|
61
66
|
headerRow: (0, _react2.jsx)("div", null),
|
|
62
67
|
headerRowHeight: 0,
|
|
63
68
|
footerRow: null
|
|
64
69
|
});
|
|
65
70
|
exports.DataGridWrapperRowsContext = DataGridWrapperRowsContext;
|
|
66
|
-
var InnerElement = /*#__PURE__*/(0, _react.forwardRef)(function (_ref2, ref) {
|
|
71
|
+
var InnerElement = /*#__PURE__*/(0, _react.memo)( /*#__PURE__*/(0, _react.forwardRef)(function (_ref2, ref) {
|
|
67
72
|
var children = _ref2.children,
|
|
68
73
|
style = _ref2.style,
|
|
69
74
|
rest = _objectWithoutProperties(_ref2, _excluded);
|
|
70
|
-
var
|
|
71
|
-
headerRowHeight =
|
|
72
|
-
headerRow =
|
|
73
|
-
footerRow =
|
|
75
|
+
var _useContext = (0, _react.useContext)(DataGridWrapperRowsContext),
|
|
76
|
+
headerRowHeight = _useContext.headerRowHeight,
|
|
77
|
+
headerRow = _useContext.headerRow,
|
|
78
|
+
footerRow = _useContext.footerRow;
|
|
79
|
+
var memoizedStyles = (0, _services.useDeepEqual)(style);
|
|
80
|
+
var innerElementStyles = (0, _react.useMemo)(function () {
|
|
81
|
+
return _objectSpread(_objectSpread({}, memoizedStyles), {}, {
|
|
82
|
+
height: memoizedStyles.height + headerRowHeight
|
|
83
|
+
});
|
|
84
|
+
}, [memoizedStyles, headerRowHeight]);
|
|
74
85
|
return (0, _react2.jsx)(_react.default.Fragment, null, (0, _react2.jsx)("div", _extends({
|
|
75
86
|
ref: ref,
|
|
76
|
-
style:
|
|
77
|
-
height: style.height + headerRowHeight
|
|
78
|
-
})
|
|
87
|
+
style: innerElementStyles
|
|
79
88
|
}, rest), headerRow, children), footerRow);
|
|
80
|
-
});
|
|
81
|
-
InnerElement.propTypes = {
|
|
82
|
-
style: _propTypes.default.shape({
|
|
83
|
-
height: _propTypes.default.number.isRequired
|
|
84
|
-
}).isRequired
|
|
85
|
-
};
|
|
89
|
+
}));
|
|
86
90
|
InnerElement.displayName = 'EuiDataGridInnerElement';
|
|
87
|
-
var EuiDataGridBodyVirtualized = function
|
|
91
|
+
var EuiDataGridBodyVirtualized = /*#__PURE__*/(0, _react.memo)(function (_ref3) {
|
|
88
92
|
var leadingControlColumns = _ref3.leadingControlColumns,
|
|
89
93
|
trailingControlColumns = _ref3.trailingControlColumns,
|
|
90
94
|
columns = _ref3.columns,
|
|
@@ -102,6 +106,7 @@ var EuiDataGridBodyVirtualized = function EuiDataGridBodyVirtualized(_ref3) {
|
|
|
102
106
|
renderFooterCellValue = _ref3.renderFooterCellValue,
|
|
103
107
|
interactiveCellId = _ref3.interactiveCellId,
|
|
104
108
|
pagination = _ref3.pagination,
|
|
109
|
+
sorting = _ref3.sorting,
|
|
105
110
|
setVisibleColumns = _ref3.setVisibleColumns,
|
|
106
111
|
switchColumnPos = _ref3.switchColumnPos,
|
|
107
112
|
onColumnResize = _ref3.onColumnResize,
|
|
@@ -151,14 +156,15 @@ var EuiDataGridBodyVirtualized = function EuiDataGridBodyVirtualized(_ref3) {
|
|
|
151
156
|
* Header & footer
|
|
152
157
|
*/
|
|
153
158
|
var _useDataGridHeader = (0, _header.useDataGridHeader)({
|
|
154
|
-
switchColumnPos: switchColumnPos,
|
|
155
|
-
setVisibleColumns: setVisibleColumns,
|
|
156
159
|
leadingControlColumns: leadingControlColumns,
|
|
157
160
|
trailingControlColumns: trailingControlColumns,
|
|
158
161
|
columns: columns,
|
|
159
162
|
columnWidths: columnWidths,
|
|
160
163
|
defaultColumnWidth: defaultColumnWidth,
|
|
161
164
|
setColumnWidth: setColumnWidth,
|
|
165
|
+
setVisibleColumns: setVisibleColumns,
|
|
166
|
+
switchColumnPos: switchColumnPos,
|
|
167
|
+
sorting: sorting,
|
|
162
168
|
schema: schema,
|
|
163
169
|
schemaDetectors: schemaDetectors
|
|
164
170
|
}),
|
|
@@ -266,29 +272,13 @@ var EuiDataGridBodyVirtualized = function EuiDataGridBodyVirtualized(_ref3) {
|
|
|
266
272
|
gridRef.current.resetAfterRowIndex(0);
|
|
267
273
|
}
|
|
268
274
|
}, [gridRef, getRowHeight]);
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
ref: gridRef,
|
|
277
|
-
className: (0, _classnames.default)('euiDataGrid__virtualized', virtualizationOptions === null || virtualizationOptions === void 0 ? void 0 : virtualizationOptions.className),
|
|
278
|
-
onItemsRendered: function onItemsRendered(itemsRendered) {
|
|
279
|
-
var _virtualizationOption;
|
|
280
|
-
gridItemsRendered.current = itemsRendered;
|
|
281
|
-
virtualizationOptions === null || virtualizationOptions === void 0 ? void 0 : (_virtualizationOption = virtualizationOptions.onItemsRendered) === null || _virtualizationOption === void 0 ? void 0 : _virtualizationOption.call(virtualizationOptions, itemsRendered);
|
|
282
|
-
},
|
|
283
|
-
innerElementType: InnerElement,
|
|
284
|
-
outerRef: outerGridRef,
|
|
285
|
-
innerRef: innerGridRef,
|
|
286
|
-
columnCount: visibleColCount,
|
|
287
|
-
width: finalWidth,
|
|
288
|
-
columnWidth: getColumnWidth,
|
|
289
|
-
height: finalHeight,
|
|
290
|
-
rowHeight: getRowHeight,
|
|
291
|
-
itemData: {
|
|
275
|
+
var onItemsRendered = (0, _react.useCallback)(function (itemsRendered) {
|
|
276
|
+
var _virtualizationOption;
|
|
277
|
+
gridItemsRendered.current = itemsRendered;
|
|
278
|
+
virtualizationOptions === null || virtualizationOptions === void 0 ? void 0 : (_virtualizationOption = virtualizationOptions.onItemsRendered) === null || _virtualizationOption === void 0 ? void 0 : _virtualizationOption.call(virtualizationOptions, itemsRendered);
|
|
279
|
+
}, [gridItemsRendered, virtualizationOptions]);
|
|
280
|
+
var itemData = (0, _react.useMemo)(function () {
|
|
281
|
+
return {
|
|
292
282
|
schemaDetectors: schemaDetectors,
|
|
293
283
|
setRowHeight: setRowHeight,
|
|
294
284
|
leadingControlColumns: leadingControlColumns,
|
|
@@ -305,11 +295,35 @@ var EuiDataGridBodyVirtualized = function EuiDataGridBodyVirtualized(_ref3) {
|
|
|
305
295
|
rowHeightsOptions: rowHeightsOptions,
|
|
306
296
|
rowHeightUtils: rowHeightUtils,
|
|
307
297
|
rowManager: rowManager,
|
|
308
|
-
pagination: pagination
|
|
309
|
-
|
|
298
|
+
pagination: pagination,
|
|
299
|
+
headerRowHeight: headerRowHeight
|
|
300
|
+
};
|
|
301
|
+
}, [schemaDetectors, setRowHeight, leadingControlColumns, trailingControlColumns, columns, visibleColCount, schema, columnWidths, defaultColumnWidth, renderCellValue, cellContext, renderCellPopover, interactiveCellId, rowHeightsOptions, rowHeightUtils, rowManager, pagination, headerRowHeight]);
|
|
302
|
+
var rowWrapperContextValue = (0, _react.useMemo)(function () {
|
|
303
|
+
return {
|
|
304
|
+
headerRowHeight: headerRowHeight,
|
|
305
|
+
headerRow: headerRow,
|
|
306
|
+
footerRow: footerRow
|
|
307
|
+
};
|
|
308
|
+
}, [headerRowHeight, headerRow, footerRow]);
|
|
309
|
+
return _utils.IS_JEST_ENVIRONMENT || finalWidth > 0 ? (0, _react2.jsx)(DataGridWrapperRowsContext.Provider, {
|
|
310
|
+
value: rowWrapperContextValue
|
|
311
|
+
}, (0, _react2.jsx)(_reactWindow.VariableSizeGrid, _extends({}, virtualizationOptions, {
|
|
312
|
+
ref: gridRef,
|
|
313
|
+
className: (0, _classnames.default)('euiDataGrid__virtualized', virtualizationOptions === null || virtualizationOptions === void 0 ? void 0 : virtualizationOptions.className),
|
|
314
|
+
onItemsRendered: onItemsRendered,
|
|
315
|
+
innerElementType: InnerElement,
|
|
316
|
+
outerRef: outerGridRef,
|
|
317
|
+
innerRef: innerGridRef,
|
|
318
|
+
columnCount: visibleColCount,
|
|
319
|
+
width: finalWidth,
|
|
320
|
+
columnWidth: getColumnWidth,
|
|
321
|
+
height: finalHeight,
|
|
322
|
+
rowHeight: getRowHeight,
|
|
323
|
+
itemData: itemData,
|
|
310
324
|
rowCount: _utils.IS_JEST_ENVIRONMENT || headerRowHeight > 0 ? visibleRowCount : 0
|
|
311
|
-
}),
|
|
312
|
-
};
|
|
325
|
+
}), Cell), scrollBorderOverlay) : null;
|
|
326
|
+
});
|
|
313
327
|
exports.EuiDataGridBodyVirtualized = EuiDataGridBodyVirtualized;
|
|
314
328
|
EuiDataGridBodyVirtualized.propTypes = {
|
|
315
329
|
leadingControlColumns: _propTypes.default.arrayOf(_propTypes.default.shape({
|
|
@@ -851,6 +865,19 @@ EuiDataGridBodyVirtualized.propTypes = {
|
|
|
851
865
|
renderFooterCellValue: _propTypes.default.oneOfType([_propTypes.default.func.isRequired, _propTypes.default.element.isRequired]),
|
|
852
866
|
renderCustomGridBody: _propTypes.default.func,
|
|
853
867
|
interactiveCellId: _propTypes.default.string.isRequired,
|
|
868
|
+
sorting: _propTypes.default.shape({
|
|
869
|
+
/**
|
|
870
|
+
* A function that receives updated column sort details in response to user interactions in the toolbar controls
|
|
871
|
+
*/
|
|
872
|
+
onSort: _propTypes.default.func.isRequired,
|
|
873
|
+
/**
|
|
874
|
+
* An array of the column ids currently being sorted and their sort direction. The array order determines the sort order. `{ id: 'A'; direction: 'asc' }`
|
|
875
|
+
*/
|
|
876
|
+
columns: _propTypes.default.arrayOf(_propTypes.default.shape({
|
|
877
|
+
id: _propTypes.default.string.isRequired,
|
|
878
|
+
direction: _propTypes.default.oneOf(["asc", "desc"]).isRequired
|
|
879
|
+
}).isRequired).isRequired
|
|
880
|
+
}),
|
|
854
881
|
pagination: _propTypes.default.any,
|
|
855
882
|
setVisibleColumns: _propTypes.default.func.isRequired,
|
|
856
883
|
switchColumnPos: _propTypes.default.func.isRequired,
|
|
@@ -936,4 +963,5 @@ EuiDataGridBodyVirtualized.propTypes = {
|
|
|
936
963
|
gridRef: _propTypes.default.any.isRequired,
|
|
937
964
|
gridItemsRendered: _propTypes.default.any.isRequired,
|
|
938
965
|
wrapperRef: _propTypes.default.any.isRequired
|
|
939
|
-
};
|
|
966
|
+
};
|
|
967
|
+
EuiDataGridBodyVirtualized.displayName = 'EuiDataGridBodyVirtualized';
|
|
@@ -97,8 +97,10 @@ var useRowManager = function useRowManager(_ref) {
|
|
|
97
97
|
});
|
|
98
98
|
}
|
|
99
99
|
}, [rowClasses]);
|
|
100
|
-
return {
|
|
101
|
-
|
|
102
|
-
|
|
100
|
+
return (0, _react.useMemo)(function () {
|
|
101
|
+
return {
|
|
102
|
+
getRow: getRow
|
|
103
|
+
};
|
|
104
|
+
}, [getRow]);
|
|
103
105
|
};
|
|
104
106
|
exports.useRowManager = useRowManager;
|
|
@@ -45,8 +45,7 @@ var useDataGridFooter = function useDataGridFooter(props) {
|
|
|
45
45
|
ref: setFooterRowRef,
|
|
46
46
|
renderCellValue: renderFooterCellValue
|
|
47
47
|
}, footerProps));
|
|
48
|
-
},
|
|
49
|
-
|
|
48
|
+
}, [props]);
|
|
50
49
|
return {
|
|
51
50
|
footerRow: footerRow,
|
|
52
51
|
footerRowHeight: footerRowHeight
|
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
6
7
|
exports.EuiDataGridControlHeaderCell = void 0;
|
|
7
|
-
var _react =
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
9
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
10
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
10
11
|
var _data_grid_header_cell_wrapper = require("./data_grid_header_cell_wrapper");
|
|
11
12
|
var _react2 = require("@emotion/react");
|
|
12
13
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
15
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
13
16
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } /*
|
|
14
17
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
15
18
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
@@ -17,7 +20,7 @@ function _extends() { _extends = Object.assign ? Object.assign.bind() : function
|
|
|
17
20
|
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
18
21
|
* Side Public License, v 1.
|
|
19
22
|
*/
|
|
20
|
-
var EuiDataGridControlHeaderCell = function
|
|
23
|
+
var EuiDataGridControlHeaderCell = /*#__PURE__*/(0, _react.memo)(function (_ref) {
|
|
21
24
|
var controlColumn = _ref.controlColumn,
|
|
22
25
|
index = _ref.index;
|
|
23
26
|
var HeaderCellRender = controlColumn.headerCellRender,
|
|
@@ -32,7 +35,7 @@ var EuiDataGridControlHeaderCell = function EuiDataGridControlHeaderCell(_ref) {
|
|
|
32
35
|
}), (0, _react2.jsx)("div", {
|
|
33
36
|
className: "euiDataGridHeaderCell__content"
|
|
34
37
|
}, (0, _react2.jsx)(HeaderCellRender, null)));
|
|
35
|
-
};
|
|
38
|
+
});
|
|
36
39
|
exports.EuiDataGridControlHeaderCell = EuiDataGridControlHeaderCell;
|
|
37
40
|
EuiDataGridControlHeaderCell.propTypes = {
|
|
38
41
|
index: _propTypes.default.number.isRequired,
|
|
@@ -66,4 +69,5 @@ EuiDataGridControlHeaderCell.propTypes = {
|
|
|
66
69
|
*/
|
|
67
70
|
footerCellProps: _propTypes.default.any
|
|
68
71
|
}).isRequired
|
|
69
|
-
};
|
|
72
|
+
};
|
|
73
|
+
EuiDataGridControlHeaderCell.displayName = 'EuiDataGridControlHeaderCell';
|
|
@@ -16,7 +16,6 @@ var _i18n = require("../../../i18n");
|
|
|
16
16
|
var _icon = require("../../../icon");
|
|
17
17
|
var _list_group = require("../../../list_group");
|
|
18
18
|
var _popover = require("../../../popover");
|
|
19
|
-
var _sorting = require("../../utils/sorting");
|
|
20
19
|
var _focus = require("../../utils/focus");
|
|
21
20
|
var _column_actions = require("./column_actions");
|
|
22
21
|
var _data_grid_column_resizer = require("./data_grid_column_resizer");
|
|
@@ -42,7 +41,20 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } /*
|
|
|
42
41
|
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
43
42
|
* Side Public License, v 1.
|
|
44
43
|
*/
|
|
45
|
-
var
|
|
44
|
+
var CellContent = function CellContent(_ref) {
|
|
45
|
+
var children = _ref.children,
|
|
46
|
+
title = _ref.title,
|
|
47
|
+
arrow = _ref.arrow;
|
|
48
|
+
return (0, _react2.jsx)(_react.default.Fragment, null, (0, _react2.jsx)("div", {
|
|
49
|
+
title: title,
|
|
50
|
+
className: "euiDataGridHeaderCell__content"
|
|
51
|
+
}, children), arrow);
|
|
52
|
+
};
|
|
53
|
+
CellContent.propTypes = {
|
|
54
|
+
title: _propTypes.default.string.isRequired,
|
|
55
|
+
arrow: _propTypes.default.node
|
|
56
|
+
};
|
|
57
|
+
var _ref3 = process.env.NODE_ENV === "production" ? {
|
|
46
58
|
name: "mc0thx-EuiDataGridHeaderCell",
|
|
47
59
|
styles: "margin-inline-start:auto;label:EuiDataGridHeaderCell;"
|
|
48
60
|
} : {
|
|
@@ -50,18 +62,19 @@ var _ref2 = process.env.NODE_ENV === "production" ? {
|
|
|
50
62
|
styles: "margin-inline-start:auto;label:EuiDataGridHeaderCell;",
|
|
51
63
|
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
52
64
|
};
|
|
53
|
-
var EuiDataGridHeaderCell = function
|
|
65
|
+
var EuiDataGridHeaderCell = /*#__PURE__*/(0, _react.memo)(function (_ref2) {
|
|
54
66
|
var _classnames;
|
|
55
|
-
var
|
|
56
|
-
|
|
57
|
-
columns =
|
|
58
|
-
columnWidths =
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
67
|
+
var index = _ref2.index,
|
|
68
|
+
column = _ref2.column,
|
|
69
|
+
columns = _ref2.columns,
|
|
70
|
+
columnWidths = _ref2.columnWidths,
|
|
71
|
+
defaultColumnWidth = _ref2.defaultColumnWidth,
|
|
72
|
+
setColumnWidth = _ref2.setColumnWidth,
|
|
73
|
+
setVisibleColumns = _ref2.setVisibleColumns,
|
|
74
|
+
switchColumnPos = _ref2.switchColumnPos,
|
|
75
|
+
sorting = _ref2.sorting,
|
|
76
|
+
schema = _ref2.schema,
|
|
77
|
+
schemaDetectors = _ref2.schemaDetectors;
|
|
65
78
|
var id = column.id,
|
|
66
79
|
display = column.display,
|
|
67
80
|
displayAsText = column.displayAsText,
|
|
@@ -71,25 +84,25 @@ var EuiDataGridHeaderCell = function EuiDataGridHeaderCell(_ref) {
|
|
|
71
84
|
var _useContext = (0, _react.useContext)(_focus.DataGridFocusContext),
|
|
72
85
|
setFocusedCell = _useContext.setFocusedCell,
|
|
73
86
|
focusFirstVisibleInteractiveCell = _useContext.focusFirstVisibleInteractiveCell;
|
|
74
|
-
var _useContext2 = (0, _react.useContext)(_sorting.DataGridSortingContext),
|
|
75
|
-
sorting = _useContext2.sorting;
|
|
76
87
|
var _useState = (0, _react.useState)(false),
|
|
77
88
|
_useState2 = _slicedToArray(_useState, 2),
|
|
78
89
|
isPopoverOpen = _useState2[0],
|
|
79
90
|
setIsPopoverOpen = _useState2[1];
|
|
80
91
|
var popoverArrowNavigationProps = usePopoverArrowNavigation();
|
|
81
|
-
var columnActions = (0,
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
92
|
+
var columnActions = (0, _react.useMemo)(function () {
|
|
93
|
+
return (0, _column_actions.getColumnActions)({
|
|
94
|
+
column: column,
|
|
95
|
+
columns: columns,
|
|
96
|
+
schema: schema,
|
|
97
|
+
schemaDetectors: schemaDetectors,
|
|
98
|
+
setVisibleColumns: setVisibleColumns,
|
|
99
|
+
focusFirstVisibleInteractiveCell: focusFirstVisibleInteractiveCell,
|
|
100
|
+
setIsPopoverOpen: setIsPopoverOpen,
|
|
101
|
+
sorting: sorting,
|
|
102
|
+
switchColumnPos: switchColumnPos,
|
|
103
|
+
setFocusedCell: setFocusedCell
|
|
104
|
+
});
|
|
105
|
+
}, [column, columns, schema, schemaDetectors, setVisibleColumns, focusFirstVisibleInteractiveCell, setIsPopoverOpen, sorting, switchColumnPos, setFocusedCell]);
|
|
93
106
|
var showColumnActions = columnActions && columnActions.length > 0;
|
|
94
107
|
var actionsButtonRef = (0, _react.useRef)(null);
|
|
95
108
|
var focusActionsButton = (0, _react.useCallback)(function () {
|
|
@@ -116,11 +129,9 @@ var EuiDataGridHeaderCell = function EuiDataGridHeaderCell(_ref) {
|
|
|
116
129
|
prefix: 'euiDataGridCellHeader',
|
|
117
130
|
suffix: 'actions'
|
|
118
131
|
});
|
|
119
|
-
var cellContent = (0, _react2.jsx)(_react.default.Fragment, null, (0, _react2.jsx)("div", {
|
|
120
|
-
title: displayAsText || id,
|
|
121
|
-
className: "euiDataGridHeaderCell__content"
|
|
122
|
-
}, display || displayAsText || id), sortingArrow);
|
|
123
132
|
var classes = (0, _classnames2.default)((_classnames = {}, _defineProperty(_classnames, "euiDataGridHeaderCell--".concat(columnType), columnType), _defineProperty(_classnames, 'euiDataGridHeaderCell--hasColumnActions', showColumnActions), _defineProperty(_classnames, 'euiDataGridHeaderCell--isActionsPopoverOpen', isPopoverOpen), _classnames), displayHeaderCellProps === null || displayHeaderCellProps === void 0 ? void 0 : displayHeaderCellProps.className);
|
|
133
|
+
var title = displayAsText || id;
|
|
134
|
+
var children = display || displayAsText || id;
|
|
124
135
|
return (0, _react2.jsx)(_data_grid_header_cell_wrapper.EuiDataGridHeaderCellWrapper, _extends({}, displayHeaderCellProps, {
|
|
125
136
|
className: classes,
|
|
126
137
|
id: id,
|
|
@@ -134,7 +145,10 @@ var EuiDataGridHeaderCell = function EuiDataGridHeaderCell(_ref) {
|
|
|
134
145
|
columnId: id,
|
|
135
146
|
columnWidth: width,
|
|
136
147
|
setColumnWidth: setColumnWidth
|
|
137
|
-
}) : null, !showColumnActions ? (0, _react2.jsx)(_react.default.Fragment, null,
|
|
148
|
+
}) : null, !showColumnActions ? (0, _react2.jsx)(_react.default.Fragment, null, (0, _react2.jsx)(CellContent, {
|
|
149
|
+
title: title,
|
|
150
|
+
arrow: sortingArrow
|
|
151
|
+
}, children), sortingScreenReaderText && (0, _react2.jsx)(_accessibility2.EuiScreenReaderOnly, null, (0, _react2.jsx)("p", null, sortingScreenReaderText))) : (0, _react2.jsx)(_react.default.Fragment, null, (0, _react2.jsx)("button", {
|
|
138
152
|
className: "euiDataGridHeaderCell__button",
|
|
139
153
|
onClick: function onClick() {
|
|
140
154
|
return setIsPopoverOpen(function (isPopoverOpen) {
|
|
@@ -150,12 +164,15 @@ var EuiDataGridHeaderCell = function EuiDataGridHeaderCell(_ref) {
|
|
|
150
164
|
"aria-describedby": "".concat(sortingAriaId, " ").concat(actionsAriaId),
|
|
151
165
|
ref: actionsButtonRef,
|
|
152
166
|
"data-test-subj": "dataGridHeaderCellActionButton-".concat(id)
|
|
153
|
-
},
|
|
167
|
+
}, (0, _react2.jsx)(CellContent, {
|
|
168
|
+
title: title,
|
|
169
|
+
arrow: sortingArrow
|
|
170
|
+
}, children), (0, _react2.jsx)(_popover.EuiPopover, _extends({
|
|
154
171
|
display: "block",
|
|
155
172
|
panelPaddingSize: "none",
|
|
156
173
|
offset: 7,
|
|
157
174
|
anchorPosition: "downRight",
|
|
158
|
-
css:
|
|
175
|
+
css: _ref3 // Align to right
|
|
159
176
|
,
|
|
160
177
|
focusTrapProps: {
|
|
161
178
|
// We need to override the default EuiPopover `onClickOutside` since the anchor is separate from the actual button
|
|
@@ -191,11 +208,7 @@ var EuiDataGridHeaderCell = function EuiDataGridHeaderCell(_ref) {
|
|
|
191
208
|
token: "euiDataGridHeaderCell.headerActions",
|
|
192
209
|
default: "Click to view column header actions"
|
|
193
210
|
}))));
|
|
194
|
-
};
|
|
195
|
-
|
|
196
|
-
/**
|
|
197
|
-
* Column sorting utility helpers
|
|
198
|
-
*/
|
|
211
|
+
});
|
|
199
212
|
exports.EuiDataGridHeaderCell = EuiDataGridHeaderCell;
|
|
200
213
|
EuiDataGridHeaderCell.propTypes = {
|
|
201
214
|
column: _propTypes.default.shape({
|
|
@@ -623,11 +636,16 @@ EuiDataGridHeaderCell.propTypes = {
|
|
|
623
636
|
}).isRequired,
|
|
624
637
|
index: _propTypes.default.number.isRequired
|
|
625
638
|
};
|
|
626
|
-
|
|
639
|
+
EuiDataGridHeaderCell.displayName = 'EuiDataGridHeaderCell';
|
|
640
|
+
|
|
641
|
+
/**
|
|
642
|
+
* Column sorting utility helpers
|
|
643
|
+
*/
|
|
644
|
+
var useSortingUtils = function useSortingUtils(_ref4) {
|
|
627
645
|
var _sorting$columns;
|
|
628
|
-
var sorting =
|
|
629
|
-
id =
|
|
630
|
-
showColumnActions =
|
|
646
|
+
var sorting = _ref4.sorting,
|
|
647
|
+
id = _ref4.id,
|
|
648
|
+
showColumnActions = _ref4.showColumnActions;
|
|
631
649
|
var sortedColumn = (0, _react.useMemo)(function () {
|
|
632
650
|
return sorting === null || sorting === void 0 ? void 0 : sorting.columns.find(function (col) {
|
|
633
651
|
return col.id === id;
|
|
@@ -639,12 +657,14 @@ var useSortingUtils = function useSortingUtils(_ref3) {
|
|
|
639
657
|
/**
|
|
640
658
|
* Arrow icon
|
|
641
659
|
*/
|
|
642
|
-
var sortingArrow =
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
660
|
+
var sortingArrow = (0, _react.useMemo)(function () {
|
|
661
|
+
return isColumnSorted ? (0, _react2.jsx)(_icon.EuiIcon, {
|
|
662
|
+
type: sortedColumn.direction === 'asc' ? 'sortUp' : 'sortDown',
|
|
663
|
+
color: "text",
|
|
664
|
+
className: "euiDataGridHeaderCell__sortingArrow",
|
|
665
|
+
"data-test-subj": "dataGridHeaderCellSortingIcon-".concat(id)
|
|
666
|
+
}) : null;
|
|
667
|
+
}, [id, isColumnSorted, sortedColumn]);
|
|
648
668
|
|
|
649
669
|
/**
|
|
650
670
|
* aria-sort attribute - should only be used when a single column is being sorted
|
|
@@ -661,9 +681,9 @@ var useSortingUtils = function useSortingUtils(_ref3) {
|
|
|
661
681
|
var _sorting$columns2;
|
|
662
682
|
if (!isColumnSorted) return null;
|
|
663
683
|
if (!showColumnActions && hasOnlyOneSort) return null; // in this scenario, the `aria-sort` attribute will be used by screen readers
|
|
664
|
-
return (0, _react2.jsx)(_react.default.Fragment, null, sorting === null || sorting === void 0 ? void 0 : (_sorting$columns2 = sorting.columns) === null || _sorting$columns2 === void 0 ? void 0 : _sorting$columns2.map(function (
|
|
665
|
-
var columnId =
|
|
666
|
-
direction =
|
|
684
|
+
return (0, _react2.jsx)(_react.default.Fragment, null, sorting === null || sorting === void 0 ? void 0 : (_sorting$columns2 = sorting.columns) === null || _sorting$columns2 === void 0 ? void 0 : _sorting$columns2.map(function (_ref5, index) {
|
|
685
|
+
var columnId = _ref5.id,
|
|
686
|
+
direction = _ref5.direction;
|
|
667
687
|
if (hasOnlyOneSort) {
|
|
668
688
|
if (direction === 'asc') {
|
|
669
689
|
return (0, _react2.jsx)(_i18n.EuiI18n, {
|