@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
|
@@ -19,7 +19,6 @@ var _i18n = require("../../../i18n");
|
|
|
19
19
|
var _icon = require("../../../icon");
|
|
20
20
|
var _list_group = require("../../../list_group");
|
|
21
21
|
var _popover = require("../../../popover");
|
|
22
|
-
var _sorting = require("../../utils/sorting");
|
|
23
22
|
var _focus = require("../../utils/focus");
|
|
24
23
|
var _column_actions = require("./column_actions");
|
|
25
24
|
var _data_grid_column_resizer = require("./data_grid_column_resizer");
|
|
@@ -34,7 +33,16 @@ function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringif
|
|
|
34
33
|
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
35
34
|
* Side Public License, v 1.
|
|
36
35
|
*/
|
|
37
|
-
var
|
|
36
|
+
var CellContent = function CellContent(_ref) {
|
|
37
|
+
var children = _ref.children,
|
|
38
|
+
title = _ref.title,
|
|
39
|
+
arrow = _ref.arrow;
|
|
40
|
+
return (0, _react2.jsx)(_react.default.Fragment, null, (0, _react2.jsx)("div", {
|
|
41
|
+
title: title,
|
|
42
|
+
className: "euiDataGridHeaderCell__content"
|
|
43
|
+
}, children), arrow);
|
|
44
|
+
};
|
|
45
|
+
var _ref3 = process.env.NODE_ENV === "production" ? {
|
|
38
46
|
name: "mc0thx-EuiDataGridHeaderCell",
|
|
39
47
|
styles: "margin-inline-start:auto;label:EuiDataGridHeaderCell;"
|
|
40
48
|
} : {
|
|
@@ -42,18 +50,19 @@ var _ref2 = process.env.NODE_ENV === "production" ? {
|
|
|
42
50
|
styles: "margin-inline-start:auto;label:EuiDataGridHeaderCell;",
|
|
43
51
|
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
44
52
|
};
|
|
45
|
-
var EuiDataGridHeaderCell = function
|
|
53
|
+
var EuiDataGridHeaderCell = /*#__PURE__*/(0, _react.memo)(function (_ref2) {
|
|
46
54
|
var _classnames;
|
|
47
|
-
var
|
|
48
|
-
|
|
49
|
-
columns =
|
|
50
|
-
columnWidths =
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
55
|
+
var index = _ref2.index,
|
|
56
|
+
column = _ref2.column,
|
|
57
|
+
columns = _ref2.columns,
|
|
58
|
+
columnWidths = _ref2.columnWidths,
|
|
59
|
+
defaultColumnWidth = _ref2.defaultColumnWidth,
|
|
60
|
+
setColumnWidth = _ref2.setColumnWidth,
|
|
61
|
+
setVisibleColumns = _ref2.setVisibleColumns,
|
|
62
|
+
switchColumnPos = _ref2.switchColumnPos,
|
|
63
|
+
sorting = _ref2.sorting,
|
|
64
|
+
schema = _ref2.schema,
|
|
65
|
+
schemaDetectors = _ref2.schemaDetectors;
|
|
57
66
|
var id = column.id,
|
|
58
67
|
display = column.display,
|
|
59
68
|
displayAsText = column.displayAsText,
|
|
@@ -63,25 +72,25 @@ var EuiDataGridHeaderCell = function EuiDataGridHeaderCell(_ref) {
|
|
|
63
72
|
var _useContext = (0, _react.useContext)(_focus.DataGridFocusContext),
|
|
64
73
|
setFocusedCell = _useContext.setFocusedCell,
|
|
65
74
|
focusFirstVisibleInteractiveCell = _useContext.focusFirstVisibleInteractiveCell;
|
|
66
|
-
var _useContext2 = (0, _react.useContext)(_sorting.DataGridSortingContext),
|
|
67
|
-
sorting = _useContext2.sorting;
|
|
68
75
|
var _useState = (0, _react.useState)(false),
|
|
69
76
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
70
77
|
isPopoverOpen = _useState2[0],
|
|
71
78
|
setIsPopoverOpen = _useState2[1];
|
|
72
79
|
var popoverArrowNavigationProps = usePopoverArrowNavigation();
|
|
73
|
-
var columnActions = (0,
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
80
|
+
var columnActions = (0, _react.useMemo)(function () {
|
|
81
|
+
return (0, _column_actions.getColumnActions)({
|
|
82
|
+
column: column,
|
|
83
|
+
columns: columns,
|
|
84
|
+
schema: schema,
|
|
85
|
+
schemaDetectors: schemaDetectors,
|
|
86
|
+
setVisibleColumns: setVisibleColumns,
|
|
87
|
+
focusFirstVisibleInteractiveCell: focusFirstVisibleInteractiveCell,
|
|
88
|
+
setIsPopoverOpen: setIsPopoverOpen,
|
|
89
|
+
sorting: sorting,
|
|
90
|
+
switchColumnPos: switchColumnPos,
|
|
91
|
+
setFocusedCell: setFocusedCell
|
|
92
|
+
});
|
|
93
|
+
}, [column, columns, schema, schemaDetectors, setVisibleColumns, focusFirstVisibleInteractiveCell, setIsPopoverOpen, sorting, switchColumnPos, setFocusedCell]);
|
|
85
94
|
var showColumnActions = columnActions && columnActions.length > 0;
|
|
86
95
|
var actionsButtonRef = (0, _react.useRef)(null);
|
|
87
96
|
var focusActionsButton = (0, _react.useCallback)(function () {
|
|
@@ -108,11 +117,9 @@ var EuiDataGridHeaderCell = function EuiDataGridHeaderCell(_ref) {
|
|
|
108
117
|
prefix: 'euiDataGridCellHeader',
|
|
109
118
|
suffix: 'actions'
|
|
110
119
|
});
|
|
111
|
-
var cellContent = (0, _react2.jsx)(_react.default.Fragment, null, (0, _react2.jsx)("div", {
|
|
112
|
-
title: displayAsText || id,
|
|
113
|
-
className: "euiDataGridHeaderCell__content"
|
|
114
|
-
}, display || displayAsText || id), sortingArrow);
|
|
115
120
|
var classes = (0, _classnames2.default)((_classnames = {}, (0, _defineProperty2.default)(_classnames, "euiDataGridHeaderCell--".concat(columnType), columnType), (0, _defineProperty2.default)(_classnames, 'euiDataGridHeaderCell--hasColumnActions', showColumnActions), (0, _defineProperty2.default)(_classnames, 'euiDataGridHeaderCell--isActionsPopoverOpen', isPopoverOpen), _classnames), displayHeaderCellProps === null || displayHeaderCellProps === void 0 ? void 0 : displayHeaderCellProps.className);
|
|
121
|
+
var title = displayAsText || id;
|
|
122
|
+
var children = display || displayAsText || id;
|
|
116
123
|
return (0, _react2.jsx)(_data_grid_header_cell_wrapper.EuiDataGridHeaderCellWrapper, (0, _extends2.default)({}, displayHeaderCellProps, {
|
|
117
124
|
className: classes,
|
|
118
125
|
id: id,
|
|
@@ -126,7 +133,10 @@ var EuiDataGridHeaderCell = function EuiDataGridHeaderCell(_ref) {
|
|
|
126
133
|
columnId: id,
|
|
127
134
|
columnWidth: width,
|
|
128
135
|
setColumnWidth: setColumnWidth
|
|
129
|
-
}) : null, !showColumnActions ? (0, _react2.jsx)(_react.default.Fragment, null,
|
|
136
|
+
}) : null, !showColumnActions ? (0, _react2.jsx)(_react.default.Fragment, null, (0, _react2.jsx)(CellContent, {
|
|
137
|
+
title: title,
|
|
138
|
+
arrow: sortingArrow
|
|
139
|
+
}, 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", {
|
|
130
140
|
className: "euiDataGridHeaderCell__button",
|
|
131
141
|
onClick: function onClick() {
|
|
132
142
|
return setIsPopoverOpen(function (isPopoverOpen) {
|
|
@@ -142,12 +152,15 @@ var EuiDataGridHeaderCell = function EuiDataGridHeaderCell(_ref) {
|
|
|
142
152
|
"aria-describedby": "".concat(sortingAriaId, " ").concat(actionsAriaId),
|
|
143
153
|
ref: actionsButtonRef,
|
|
144
154
|
"data-test-subj": "dataGridHeaderCellActionButton-".concat(id)
|
|
145
|
-
},
|
|
155
|
+
}, (0, _react2.jsx)(CellContent, {
|
|
156
|
+
title: title,
|
|
157
|
+
arrow: sortingArrow
|
|
158
|
+
}, children), (0, _react2.jsx)(_popover.EuiPopover, (0, _extends2.default)({
|
|
146
159
|
display: "block",
|
|
147
160
|
panelPaddingSize: "none",
|
|
148
161
|
offset: 7,
|
|
149
162
|
anchorPosition: "downRight",
|
|
150
|
-
css:
|
|
163
|
+
css: _ref3 // Align to right
|
|
151
164
|
,
|
|
152
165
|
focusTrapProps: {
|
|
153
166
|
// We need to override the default EuiPopover `onClickOutside` since the anchor is separate from the actual button
|
|
@@ -183,17 +196,18 @@ var EuiDataGridHeaderCell = function EuiDataGridHeaderCell(_ref) {
|
|
|
183
196
|
token: "euiDataGridHeaderCell.headerActions",
|
|
184
197
|
default: "Click to view column header actions"
|
|
185
198
|
}))));
|
|
186
|
-
};
|
|
199
|
+
});
|
|
200
|
+
exports.EuiDataGridHeaderCell = EuiDataGridHeaderCell;
|
|
201
|
+
EuiDataGridHeaderCell.displayName = 'EuiDataGridHeaderCell';
|
|
187
202
|
|
|
188
203
|
/**
|
|
189
204
|
* Column sorting utility helpers
|
|
190
205
|
*/
|
|
191
|
-
|
|
192
|
-
var useSortingUtils = function useSortingUtils(_ref3) {
|
|
206
|
+
var useSortingUtils = function useSortingUtils(_ref4) {
|
|
193
207
|
var _sorting$columns;
|
|
194
|
-
var sorting =
|
|
195
|
-
id =
|
|
196
|
-
showColumnActions =
|
|
208
|
+
var sorting = _ref4.sorting,
|
|
209
|
+
id = _ref4.id,
|
|
210
|
+
showColumnActions = _ref4.showColumnActions;
|
|
197
211
|
var sortedColumn = (0, _react.useMemo)(function () {
|
|
198
212
|
return sorting === null || sorting === void 0 ? void 0 : sorting.columns.find(function (col) {
|
|
199
213
|
return col.id === id;
|
|
@@ -205,12 +219,14 @@ var useSortingUtils = function useSortingUtils(_ref3) {
|
|
|
205
219
|
/**
|
|
206
220
|
* Arrow icon
|
|
207
221
|
*/
|
|
208
|
-
var sortingArrow =
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
222
|
+
var sortingArrow = (0, _react.useMemo)(function () {
|
|
223
|
+
return isColumnSorted ? (0, _react2.jsx)(_icon.EuiIcon, {
|
|
224
|
+
type: sortedColumn.direction === 'asc' ? 'sortUp' : 'sortDown',
|
|
225
|
+
color: "text",
|
|
226
|
+
className: "euiDataGridHeaderCell__sortingArrow",
|
|
227
|
+
"data-test-subj": "dataGridHeaderCellSortingIcon-".concat(id)
|
|
228
|
+
}) : null;
|
|
229
|
+
}, [id, isColumnSorted, sortedColumn]);
|
|
214
230
|
|
|
215
231
|
/**
|
|
216
232
|
* aria-sort attribute - should only be used when a single column is being sorted
|
|
@@ -227,9 +243,9 @@ var useSortingUtils = function useSortingUtils(_ref3) {
|
|
|
227
243
|
var _sorting$columns2;
|
|
228
244
|
if (!isColumnSorted) return null;
|
|
229
245
|
if (!showColumnActions && hasOnlyOneSort) return null; // in this scenario, the `aria-sort` attribute will be used by screen readers
|
|
230
|
-
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 (
|
|
231
|
-
var columnId =
|
|
232
|
-
direction =
|
|
246
|
+
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) {
|
|
247
|
+
var columnId = _ref5.id,
|
|
248
|
+
direction = _ref5.direction;
|
|
233
249
|
if (hasOnlyOneSort) {
|
|
234
250
|
if (direction === 'asc') {
|
|
235
251
|
return (0, _react2.jsx)(_i18n.EuiI18n, {
|
|
@@ -14,7 +14,7 @@ var _data_grid_control_header_cell = require("./data_grid_control_header_cell");
|
|
|
14
14
|
var _data_grid_header_cell = require("./data_grid_header_cell");
|
|
15
15
|
var _data_grid_types = require("../../data_grid_types");
|
|
16
16
|
var _react2 = require("@emotion/react");
|
|
17
|
-
var _excluded = ["
|
|
17
|
+
var _excluded = ["className", "data-test-subj", "leadingControlColumns", "trailingControlColumns", "columns", "columnWidths", "defaultColumnWidth", "setColumnWidth", "setVisibleColumns", "switchColumnPos", "sorting", "schema", "schemaDetectors"];
|
|
18
18
|
/*
|
|
19
19
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
20
20
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
@@ -24,21 +24,22 @@ var _excluded = ["leadingControlColumns", "trailingControlColumns", "columns", "
|
|
|
24
24
|
*/
|
|
25
25
|
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); }
|
|
26
26
|
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; }
|
|
27
|
-
var EuiDataGridHeaderRow = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
28
|
-
var
|
|
27
|
+
var EuiDataGridHeaderRow = /*#__PURE__*/(0, _react.memo)( /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
28
|
+
var className = props.className,
|
|
29
|
+
_dataTestSubj = props['data-test-subj'],
|
|
30
|
+
_props$leadingControl = props.leadingControlColumns,
|
|
29
31
|
leadingControlColumns = _props$leadingControl === void 0 ? _data_grid_types.emptyControlColumns : _props$leadingControl,
|
|
30
32
|
_props$trailingContro = props.trailingControlColumns,
|
|
31
33
|
trailingControlColumns = _props$trailingContro === void 0 ? _data_grid_types.emptyControlColumns : _props$trailingContro,
|
|
32
34
|
columns = props.columns,
|
|
33
|
-
schema = props.schema,
|
|
34
|
-
schemaDetectors = props.schemaDetectors,
|
|
35
35
|
columnWidths = props.columnWidths,
|
|
36
36
|
defaultColumnWidth = props.defaultColumnWidth,
|
|
37
|
-
className = props.className,
|
|
38
37
|
setColumnWidth = props.setColumnWidth,
|
|
39
38
|
setVisibleColumns = props.setVisibleColumns,
|
|
40
39
|
switchColumnPos = props.switchColumnPos,
|
|
41
|
-
|
|
40
|
+
sorting = props.sorting,
|
|
41
|
+
schema = props.schema,
|
|
42
|
+
schemaDetectors = props.schemaDetectors,
|
|
42
43
|
rest = (0, _objectWithoutProperties2.default)(props, _excluded);
|
|
43
44
|
var classes = (0, _classnames.default)('euiDataGridHeader', className);
|
|
44
45
|
var dataTestSubj = (0, _classnames.default)('dataGridHeader', _dataTestSubj);
|
|
@@ -56,16 +57,17 @@ var EuiDataGridHeaderRow = /*#__PURE__*/(0, _react.forwardRef)(function (props,
|
|
|
56
57
|
}), columns.map(function (column, index) {
|
|
57
58
|
return (0, _react2.jsx)(_data_grid_header_cell.EuiDataGridHeaderCell, {
|
|
58
59
|
key: column.id,
|
|
60
|
+
index: index + leadingControlColumns.length,
|
|
59
61
|
column: column,
|
|
60
62
|
columns: columns,
|
|
61
|
-
index: index + leadingControlColumns.length,
|
|
62
63
|
columnWidths: columnWidths,
|
|
63
|
-
|
|
64
|
-
schemaDetectors: schemaDetectors,
|
|
64
|
+
defaultColumnWidth: defaultColumnWidth,
|
|
65
65
|
setColumnWidth: setColumnWidth,
|
|
66
66
|
setVisibleColumns: setVisibleColumns,
|
|
67
67
|
switchColumnPos: switchColumnPos,
|
|
68
|
-
|
|
68
|
+
sorting: sorting,
|
|
69
|
+
schema: schema,
|
|
70
|
+
schemaDetectors: schemaDetectors
|
|
69
71
|
});
|
|
70
72
|
}), trailingControlColumns.map(function (controlColumn, index) {
|
|
71
73
|
return (0, _react2.jsx)(_data_grid_control_header_cell.EuiDataGridControlHeaderCell, {
|
|
@@ -74,6 +76,6 @@ var EuiDataGridHeaderRow = /*#__PURE__*/(0, _react.forwardRef)(function (props,
|
|
|
74
76
|
controlColumn: controlColumn
|
|
75
77
|
});
|
|
76
78
|
}));
|
|
77
|
-
});
|
|
79
|
+
}));
|
|
78
80
|
exports.EuiDataGridHeaderRow = EuiDataGridHeaderRow;
|
|
79
81
|
EuiDataGridHeaderRow.displayName = 'EuiDataGridHeaderRow';
|
|
@@ -36,11 +36,12 @@ var useDataGridHeader = function useDataGridHeader(props) {
|
|
|
36
36
|
return (0, _react2.jsx)(_data_grid_header_row.EuiDataGridHeaderRow, (0, _extends2.default)({
|
|
37
37
|
ref: setHeaderRowRef
|
|
38
38
|
}, props));
|
|
39
|
-
},
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
39
|
+
}, [props]);
|
|
40
|
+
return (0, _react.useMemo)(function () {
|
|
41
|
+
return {
|
|
42
|
+
headerRow: headerRow,
|
|
43
|
+
headerRowHeight: headerRowHeight
|
|
44
|
+
};
|
|
45
|
+
}, [headerRow, headerRowHeight]);
|
|
45
46
|
};
|
|
46
47
|
exports.useDataGridHeader = useDataGridHeader;
|
|
@@ -81,10 +81,6 @@ var useDataGridColumnSelector = function useDataGridColumnSelector(availableColu
|
|
|
81
81
|
}, [sortedColumns, columnSearchText, displayValues]);
|
|
82
82
|
var isDragEnabled = allowColumnReorder && columnSearchText.length === 0; // only allow drag-and-drop when not filtering columns
|
|
83
83
|
var dragHandleAriaLabel = (0, _i18n.useEuiI18n)('euiColumnSelector.dragHandleAriaLabel', 'Drag handle');
|
|
84
|
-
var buttonText = (0, _react2.jsx)(_i18n.EuiI18n, {
|
|
85
|
-
token: "euiColumnSelector.button",
|
|
86
|
-
default: "Columns"
|
|
87
|
-
});
|
|
88
84
|
var orderedVisibleColumns = (0, _react.useMemo)(function () {
|
|
89
85
|
return visibleColumns.map(function (columnId) {
|
|
90
86
|
return availableColumns.find(function (_ref3) {
|
|
@@ -96,127 +92,132 @@ var useDataGridColumnSelector = function useDataGridColumnSelector(availableColu
|
|
|
96
92
|
return column != null;
|
|
97
93
|
});
|
|
98
94
|
}, [availableColumns, visibleColumns]);
|
|
99
|
-
var columnSelector =
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
anchorPosition: "downLeft",
|
|
106
|
-
panelPaddingSize: "s",
|
|
107
|
-
hasDragDrop: true,
|
|
108
|
-
button: (0, _react2.jsx)(_data_grid_toolbar_control.EuiDataGridToolbarControl, {
|
|
109
|
-
badgeContent: numberOfHiddenFields > 0 ? "".concat(orderedVisibleColumns.length, "/").concat(availableColumns.length) : availableColumns.length,
|
|
110
|
-
iconType: "tableDensityNormal",
|
|
111
|
-
"data-test-subj": "dataGridColumnSelectorButton",
|
|
112
|
-
onClick: function onClick() {
|
|
113
|
-
return setIsOpen(!isOpen);
|
|
114
|
-
}
|
|
115
|
-
}, buttonText)
|
|
116
|
-
}, allowColumnHiding && (0, _react2.jsx)(_popover.EuiPopoverTitle, null, (0, _react2.jsx)(_i18n.EuiI18n, {
|
|
117
|
-
tokens: ['euiColumnSelector.search', 'euiColumnSelector.searchcolumns'],
|
|
118
|
-
defaults: ['Search', 'Search columns']
|
|
119
|
-
}, function (_ref4) {
|
|
120
|
-
var _ref5 = (0, _slicedToArray2.default)(_ref4, 2),
|
|
121
|
-
search = _ref5[0],
|
|
122
|
-
searchcolumns = _ref5[1];
|
|
123
|
-
return (0, _react2.jsx)(_form.EuiFieldText, {
|
|
124
|
-
compressed: true,
|
|
125
|
-
placeholder: search,
|
|
126
|
-
"aria-label": searchcolumns,
|
|
127
|
-
value: columnSearchText,
|
|
128
|
-
onChange: function onChange(e) {
|
|
129
|
-
return setColumnSearchText(e.currentTarget.value);
|
|
95
|
+
var columnSelector = (0, _react.useMemo)(function () {
|
|
96
|
+
return allowColumnHiding || allowColumnReorder ? (0, _react2.jsx)(_popover.EuiPopover, {
|
|
97
|
+
"data-test-subj": "dataGridColumnSelectorPopover",
|
|
98
|
+
isOpen: isOpen,
|
|
99
|
+
closePopover: function closePopover() {
|
|
100
|
+
return setIsOpen(false);
|
|
130
101
|
},
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
}, (0, _react2.jsx)(_flex.EuiFlexGroup, {
|
|
154
|
-
responsive: false,
|
|
155
|
-
gutterSize: "s",
|
|
156
|
-
alignItems: "center"
|
|
157
|
-
}, allowColumnHiding && (0, _react2.jsx)(_flex.EuiFlexItem, {
|
|
158
|
-
grow: false
|
|
159
|
-
}, (0, _react2.jsx)(_form.EuiSwitch, {
|
|
160
|
-
name: id,
|
|
161
|
-
label: displayValues[id] || id,
|
|
162
|
-
showLabel: false,
|
|
163
|
-
checked: visibleColumnIds.has(id),
|
|
102
|
+
anchorPosition: "downLeft",
|
|
103
|
+
panelPaddingSize: "s",
|
|
104
|
+
hasDragDrop: true,
|
|
105
|
+
button: (0, _react2.jsx)(_data_grid_toolbar_control.EuiDataGridToolbarControl, {
|
|
106
|
+
badgeContent: numberOfHiddenFields > 0 ? "".concat(orderedVisibleColumns.length, "/").concat(availableColumns.length) : availableColumns.length,
|
|
107
|
+
iconType: "tableDensityNormal",
|
|
108
|
+
"data-test-subj": "dataGridColumnSelectorButton",
|
|
109
|
+
onClick: function onClick() {
|
|
110
|
+
return setIsOpen(!isOpen);
|
|
111
|
+
}
|
|
112
|
+
}, (0, _react2.jsx)(_i18n.EuiI18n, {
|
|
113
|
+
token: "euiColumnSelector.button",
|
|
114
|
+
default: "Columns"
|
|
115
|
+
}))
|
|
116
|
+
}, allowColumnHiding && (0, _react2.jsx)(_popover.EuiPopoverTitle, null, (0, _react2.jsx)(_i18n.EuiI18n, {
|
|
117
|
+
tokens: ['euiColumnSelector.search', 'euiColumnSelector.searchcolumns'],
|
|
118
|
+
defaults: ['Search', 'Search columns']
|
|
119
|
+
}, function (_ref4) {
|
|
120
|
+
var _ref5 = (0, _slicedToArray2.default)(_ref4, 2),
|
|
121
|
+
search = _ref5[0],
|
|
122
|
+
searchcolumns = _ref5[1];
|
|
123
|
+
return (0, _react2.jsx)(_form.EuiFieldText, {
|
|
164
124
|
compressed: true,
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
});
|
|
171
|
-
setVisibleColumns(nextVisibleColumns);
|
|
125
|
+
placeholder: search,
|
|
126
|
+
"aria-label": searchcolumns,
|
|
127
|
+
value: columnSearchText,
|
|
128
|
+
onChange: function onChange(e) {
|
|
129
|
+
return setColumnSearchText(e.currentTarget.value);
|
|
172
130
|
},
|
|
173
|
-
"data-test-subj": "
|
|
174
|
-
})
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
})
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
131
|
+
"data-test-subj": "dataGridColumnSelectorSearch"
|
|
132
|
+
});
|
|
133
|
+
})), (0, _react2.jsx)(_drag_and_drop.EuiDragDropContext, {
|
|
134
|
+
onDragEnd: onDragEnd
|
|
135
|
+
}, (0, _react2.jsx)(_drag_and_drop.EuiDroppable, {
|
|
136
|
+
droppableId: "columnOrder",
|
|
137
|
+
isDropDisabled: !isDragEnabled,
|
|
138
|
+
className: "euiDataGrid__controlScroll"
|
|
139
|
+
}, (0, _react2.jsx)(_react.default.Fragment, null, filteredColumns.map(function (id, index) {
|
|
140
|
+
return (0, _react2.jsx)(_drag_and_drop.EuiDraggable, {
|
|
141
|
+
key: id,
|
|
142
|
+
draggableId: id,
|
|
143
|
+
index: index,
|
|
144
|
+
isDragDisabled: !isDragEnabled,
|
|
145
|
+
hasInteractiveChildren: true,
|
|
146
|
+
customDragHandle: true
|
|
147
|
+
}, function (provided, state) {
|
|
148
|
+
return (0, _react2.jsx)("div", {
|
|
149
|
+
className: (0, _classnames.default)('euiDataGridColumnSelector__item', {
|
|
150
|
+
'euiDataGridColumnSelector__item-isDragging': state.isDragging
|
|
151
|
+
}),
|
|
152
|
+
"data-test-subj": "dataGridColumnSelectorColumnItem-".concat(id)
|
|
153
|
+
}, (0, _react2.jsx)(_flex.EuiFlexGroup, {
|
|
154
|
+
responsive: false,
|
|
155
|
+
gutterSize: "s",
|
|
156
|
+
alignItems: "center"
|
|
157
|
+
}, allowColumnHiding && (0, _react2.jsx)(_flex.EuiFlexItem, {
|
|
158
|
+
grow: false
|
|
159
|
+
}, (0, _react2.jsx)(_form.EuiSwitch, {
|
|
160
|
+
name: id,
|
|
161
|
+
label: displayValues[id] || id,
|
|
162
|
+
showLabel: false,
|
|
163
|
+
checked: visibleColumnIds.has(id),
|
|
164
|
+
compressed: true,
|
|
165
|
+
className: "euiSwitch--mini",
|
|
166
|
+
onChange: function onChange(event) {
|
|
167
|
+
var checked = event.target.checked;
|
|
168
|
+
var nextVisibleColumns = sortedColumns.filter(function (columnId) {
|
|
169
|
+
return checked ? visibleColumnIds.has(columnId) || id === columnId : visibleColumnIds.has(columnId) && id !== columnId;
|
|
170
|
+
});
|
|
171
|
+
setVisibleColumns(nextVisibleColumns);
|
|
172
|
+
},
|
|
173
|
+
"data-test-subj": "dataGridColumnSelectorToggleColumnVisibility-".concat(id)
|
|
174
|
+
})), (0, _react2.jsx)(_flex.EuiFlexItem
|
|
175
|
+
// This extra column name flex item affords the column more grabbable real estate
|
|
176
|
+
// for mouse users, while hiding repetition for keyboard/screen reader users
|
|
177
|
+
, (0, _extends2.default)({}, provided.dragHandleProps, {
|
|
178
|
+
"aria-hidden": true,
|
|
179
|
+
tabIndex: -1
|
|
180
|
+
}), (0, _react2.jsx)("span", {
|
|
181
|
+
className: "euiDataGridColumnSelector__itemLabel"
|
|
182
|
+
}, displayValues[id] || id)), isDragEnabled && (0, _react2.jsx)(_flex.EuiFlexItem, (0, _extends2.default)({
|
|
183
|
+
grow: false
|
|
184
|
+
}, provided.dragHandleProps, {
|
|
185
|
+
"aria-label": dragHandleAriaLabel
|
|
186
|
+
}), (0, _react2.jsx)(_icon.EuiIcon, {
|
|
187
|
+
type: "grab",
|
|
188
|
+
color: "subdued"
|
|
189
|
+
}))));
|
|
190
|
+
});
|
|
191
|
+
})))), allowColumnHiding && (0, _react2.jsx)(_popover.EuiPopoverFooter, null, (0, _react2.jsx)(_flex.EuiFlexGroup, {
|
|
192
|
+
gutterSize: "s",
|
|
193
|
+
responsive: false,
|
|
194
|
+
justifyContent: "spaceBetween"
|
|
195
|
+
}, (0, _react2.jsx)(_flex.EuiFlexItem, {
|
|
196
|
+
grow: false
|
|
197
|
+
}, (0, _react2.jsx)(_button.EuiButtonEmpty, {
|
|
198
|
+
size: "xs",
|
|
199
|
+
flush: "left",
|
|
200
|
+
onClick: function onClick() {
|
|
201
|
+
return setVisibleColumns(sortedColumns);
|
|
202
|
+
},
|
|
203
|
+
"data-test-subj": "dataGridColumnSelectorShowAllButton"
|
|
204
|
+
}, (0, _react2.jsx)(_i18n.EuiI18n, {
|
|
205
|
+
token: "euiColumnSelector.selectAll",
|
|
206
|
+
default: "Show all"
|
|
207
|
+
}))), (0, _react2.jsx)(_flex.EuiFlexItem, {
|
|
208
|
+
grow: false
|
|
209
|
+
}, (0, _react2.jsx)(_button.EuiButtonEmpty, {
|
|
210
|
+
size: "xs",
|
|
211
|
+
flush: "right",
|
|
212
|
+
onClick: function onClick() {
|
|
213
|
+
return setVisibleColumns([]);
|
|
214
|
+
},
|
|
215
|
+
"data-test-subj": "dataGridColumnSelectorHideAllButton"
|
|
216
|
+
}, (0, _react2.jsx)(_i18n.EuiI18n, {
|
|
217
|
+
token: "euiColumnSelector.hideAll",
|
|
218
|
+
default: "Hide all"
|
|
219
|
+
})))))) : null;
|
|
220
|
+
}, [availableColumns.length, numberOfHiddenFields, orderedVisibleColumns.length, allowColumnHiding, allowColumnReorder, isOpen, columnSearchText, displayValues, visibleColumnIds, sortedColumns, setVisibleColumns, setIsOpen, onDragEnd, isDragEnabled, dragHandleAriaLabel, filteredColumns]);
|
|
220
221
|
|
|
221
222
|
/**
|
|
222
223
|
* Used for moving columns left/right, available in the headers actions menu
|
|
@@ -232,6 +233,8 @@ var useDataGridColumnSelector = function useDataGridColumnSelector(availableColu
|
|
|
232
233
|
nextSortedColumns.splice(moveToIdx, 0, fromColId);
|
|
233
234
|
setColumns(nextSortedColumns);
|
|
234
235
|
}, [setColumns, sortedColumns]);
|
|
235
|
-
return
|
|
236
|
+
return (0, _react.useMemo)(function () {
|
|
237
|
+
return [columnSelector, orderedVisibleColumns, setVisibleColumns, switchColumnPos];
|
|
238
|
+
}, [columnSelector, orderedVisibleColumns, setVisibleColumns, switchColumnPos]);
|
|
236
239
|
};
|
|
237
240
|
exports.useDataGridColumnSelector = useDataGridColumnSelector;
|