@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
|
@@ -27,10 +27,11 @@ export var useDataGridHeader = function useDataGridHeader(props) {
|
|
|
27
27
|
return ___EmotionJSX(EuiDataGridHeaderRow, _extends({
|
|
28
28
|
ref: setHeaderRowRef
|
|
29
29
|
}, props));
|
|
30
|
-
},
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
30
|
+
}, [props]);
|
|
31
|
+
return useMemo(function () {
|
|
32
|
+
return {
|
|
33
|
+
headerRow: headerRow,
|
|
34
|
+
headerRowHeight: headerRowHeight
|
|
35
|
+
};
|
|
36
|
+
}, [headerRow, headerRowHeight]);
|
|
36
37
|
};
|
|
@@ -71,10 +71,6 @@ export var useDataGridColumnSelector = function useDataGridColumnSelector(availa
|
|
|
71
71
|
}, [sortedColumns, columnSearchText, displayValues]);
|
|
72
72
|
var isDragEnabled = allowColumnReorder && columnSearchText.length === 0; // only allow drag-and-drop when not filtering columns
|
|
73
73
|
var dragHandleAriaLabel = useEuiI18n('euiColumnSelector.dragHandleAriaLabel', 'Drag handle');
|
|
74
|
-
var buttonText = ___EmotionJSX(EuiI18n, {
|
|
75
|
-
token: "euiColumnSelector.button",
|
|
76
|
-
default: "Columns"
|
|
77
|
-
});
|
|
78
74
|
var orderedVisibleColumns = useMemo(function () {
|
|
79
75
|
return visibleColumns.map(function (columnId) {
|
|
80
76
|
return availableColumns.find(function (_ref3) {
|
|
@@ -86,127 +82,132 @@ export var useDataGridColumnSelector = function useDataGridColumnSelector(availa
|
|
|
86
82
|
return column != null;
|
|
87
83
|
});
|
|
88
84
|
}, [availableColumns, visibleColumns]);
|
|
89
|
-
var columnSelector =
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
anchorPosition: "downLeft",
|
|
96
|
-
panelPaddingSize: "s",
|
|
97
|
-
hasDragDrop: true,
|
|
98
|
-
button: ___EmotionJSX(EuiDataGridToolbarControl, {
|
|
99
|
-
badgeContent: numberOfHiddenFields > 0 ? "".concat(orderedVisibleColumns.length, "/").concat(availableColumns.length) : availableColumns.length,
|
|
100
|
-
iconType: "tableDensityNormal",
|
|
101
|
-
"data-test-subj": "dataGridColumnSelectorButton",
|
|
102
|
-
onClick: function onClick() {
|
|
103
|
-
return setIsOpen(!isOpen);
|
|
104
|
-
}
|
|
105
|
-
}, buttonText)
|
|
106
|
-
}, allowColumnHiding && ___EmotionJSX(EuiPopoverTitle, null, ___EmotionJSX(EuiI18n, {
|
|
107
|
-
tokens: ['euiColumnSelector.search', 'euiColumnSelector.searchcolumns'],
|
|
108
|
-
defaults: ['Search', 'Search columns']
|
|
109
|
-
}, function (_ref4) {
|
|
110
|
-
var _ref5 = _slicedToArray(_ref4, 2),
|
|
111
|
-
search = _ref5[0],
|
|
112
|
-
searchcolumns = _ref5[1];
|
|
113
|
-
return ___EmotionJSX(EuiFieldText, {
|
|
114
|
-
compressed: true,
|
|
115
|
-
placeholder: search,
|
|
116
|
-
"aria-label": searchcolumns,
|
|
117
|
-
value: columnSearchText,
|
|
118
|
-
onChange: function onChange(e) {
|
|
119
|
-
return setColumnSearchText(e.currentTarget.value);
|
|
85
|
+
var columnSelector = useMemo(function () {
|
|
86
|
+
return allowColumnHiding || allowColumnReorder ? ___EmotionJSX(EuiPopover, {
|
|
87
|
+
"data-test-subj": "dataGridColumnSelectorPopover",
|
|
88
|
+
isOpen: isOpen,
|
|
89
|
+
closePopover: function closePopover() {
|
|
90
|
+
return setIsOpen(false);
|
|
120
91
|
},
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
}, ___EmotionJSX(EuiFlexGroup, {
|
|
144
|
-
responsive: false,
|
|
145
|
-
gutterSize: "s",
|
|
146
|
-
alignItems: "center"
|
|
147
|
-
}, allowColumnHiding && ___EmotionJSX(EuiFlexItem, {
|
|
148
|
-
grow: false
|
|
149
|
-
}, ___EmotionJSX(EuiSwitch, {
|
|
150
|
-
name: id,
|
|
151
|
-
label: displayValues[id] || id,
|
|
152
|
-
showLabel: false,
|
|
153
|
-
checked: visibleColumnIds.has(id),
|
|
92
|
+
anchorPosition: "downLeft",
|
|
93
|
+
panelPaddingSize: "s",
|
|
94
|
+
hasDragDrop: true,
|
|
95
|
+
button: ___EmotionJSX(EuiDataGridToolbarControl, {
|
|
96
|
+
badgeContent: numberOfHiddenFields > 0 ? "".concat(orderedVisibleColumns.length, "/").concat(availableColumns.length) : availableColumns.length,
|
|
97
|
+
iconType: "tableDensityNormal",
|
|
98
|
+
"data-test-subj": "dataGridColumnSelectorButton",
|
|
99
|
+
onClick: function onClick() {
|
|
100
|
+
return setIsOpen(!isOpen);
|
|
101
|
+
}
|
|
102
|
+
}, ___EmotionJSX(EuiI18n, {
|
|
103
|
+
token: "euiColumnSelector.button",
|
|
104
|
+
default: "Columns"
|
|
105
|
+
}))
|
|
106
|
+
}, allowColumnHiding && ___EmotionJSX(EuiPopoverTitle, null, ___EmotionJSX(EuiI18n, {
|
|
107
|
+
tokens: ['euiColumnSelector.search', 'euiColumnSelector.searchcolumns'],
|
|
108
|
+
defaults: ['Search', 'Search columns']
|
|
109
|
+
}, function (_ref4) {
|
|
110
|
+
var _ref5 = _slicedToArray(_ref4, 2),
|
|
111
|
+
search = _ref5[0],
|
|
112
|
+
searchcolumns = _ref5[1];
|
|
113
|
+
return ___EmotionJSX(EuiFieldText, {
|
|
154
114
|
compressed: true,
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
});
|
|
161
|
-
setVisibleColumns(nextVisibleColumns);
|
|
115
|
+
placeholder: search,
|
|
116
|
+
"aria-label": searchcolumns,
|
|
117
|
+
value: columnSearchText,
|
|
118
|
+
onChange: function onChange(e) {
|
|
119
|
+
return setColumnSearchText(e.currentTarget.value);
|
|
162
120
|
},
|
|
163
|
-
"data-test-subj": "
|
|
164
|
-
})
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
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
|
-
|
|
121
|
+
"data-test-subj": "dataGridColumnSelectorSearch"
|
|
122
|
+
});
|
|
123
|
+
})), ___EmotionJSX(EuiDragDropContext, {
|
|
124
|
+
onDragEnd: onDragEnd
|
|
125
|
+
}, ___EmotionJSX(EuiDroppable, {
|
|
126
|
+
droppableId: "columnOrder",
|
|
127
|
+
isDropDisabled: !isDragEnabled,
|
|
128
|
+
className: "euiDataGrid__controlScroll"
|
|
129
|
+
}, ___EmotionJSX(React.Fragment, null, filteredColumns.map(function (id, index) {
|
|
130
|
+
return ___EmotionJSX(EuiDraggable, {
|
|
131
|
+
key: id,
|
|
132
|
+
draggableId: id,
|
|
133
|
+
index: index,
|
|
134
|
+
isDragDisabled: !isDragEnabled,
|
|
135
|
+
hasInteractiveChildren: true,
|
|
136
|
+
customDragHandle: true
|
|
137
|
+
}, function (provided, state) {
|
|
138
|
+
return ___EmotionJSX("div", {
|
|
139
|
+
className: classNames('euiDataGridColumnSelector__item', {
|
|
140
|
+
'euiDataGridColumnSelector__item-isDragging': state.isDragging
|
|
141
|
+
}),
|
|
142
|
+
"data-test-subj": "dataGridColumnSelectorColumnItem-".concat(id)
|
|
143
|
+
}, ___EmotionJSX(EuiFlexGroup, {
|
|
144
|
+
responsive: false,
|
|
145
|
+
gutterSize: "s",
|
|
146
|
+
alignItems: "center"
|
|
147
|
+
}, allowColumnHiding && ___EmotionJSX(EuiFlexItem, {
|
|
148
|
+
grow: false
|
|
149
|
+
}, ___EmotionJSX(EuiSwitch, {
|
|
150
|
+
name: id,
|
|
151
|
+
label: displayValues[id] || id,
|
|
152
|
+
showLabel: false,
|
|
153
|
+
checked: visibleColumnIds.has(id),
|
|
154
|
+
compressed: true,
|
|
155
|
+
className: "euiSwitch--mini",
|
|
156
|
+
onChange: function onChange(event) {
|
|
157
|
+
var checked = event.target.checked;
|
|
158
|
+
var nextVisibleColumns = sortedColumns.filter(function (columnId) {
|
|
159
|
+
return checked ? visibleColumnIds.has(columnId) || id === columnId : visibleColumnIds.has(columnId) && id !== columnId;
|
|
160
|
+
});
|
|
161
|
+
setVisibleColumns(nextVisibleColumns);
|
|
162
|
+
},
|
|
163
|
+
"data-test-subj": "dataGridColumnSelectorToggleColumnVisibility-".concat(id)
|
|
164
|
+
})), ___EmotionJSX(EuiFlexItem
|
|
165
|
+
// This extra column name flex item affords the column more grabbable real estate
|
|
166
|
+
// for mouse users, while hiding repetition for keyboard/screen reader users
|
|
167
|
+
, _extends({}, provided.dragHandleProps, {
|
|
168
|
+
"aria-hidden": true,
|
|
169
|
+
tabIndex: -1
|
|
170
|
+
}), ___EmotionJSX("span", {
|
|
171
|
+
className: "euiDataGridColumnSelector__itemLabel"
|
|
172
|
+
}, displayValues[id] || id)), isDragEnabled && ___EmotionJSX(EuiFlexItem, _extends({
|
|
173
|
+
grow: false
|
|
174
|
+
}, provided.dragHandleProps, {
|
|
175
|
+
"aria-label": dragHandleAriaLabel
|
|
176
|
+
}), ___EmotionJSX(EuiIcon, {
|
|
177
|
+
type: "grab",
|
|
178
|
+
color: "subdued"
|
|
179
|
+
}))));
|
|
180
|
+
});
|
|
181
|
+
})))), allowColumnHiding && ___EmotionJSX(EuiPopoverFooter, null, ___EmotionJSX(EuiFlexGroup, {
|
|
182
|
+
gutterSize: "s",
|
|
183
|
+
responsive: false,
|
|
184
|
+
justifyContent: "spaceBetween"
|
|
185
|
+
}, ___EmotionJSX(EuiFlexItem, {
|
|
186
|
+
grow: false
|
|
187
|
+
}, ___EmotionJSX(EuiButtonEmpty, {
|
|
188
|
+
size: "xs",
|
|
189
|
+
flush: "left",
|
|
190
|
+
onClick: function onClick() {
|
|
191
|
+
return setVisibleColumns(sortedColumns);
|
|
192
|
+
},
|
|
193
|
+
"data-test-subj": "dataGridColumnSelectorShowAllButton"
|
|
194
|
+
}, ___EmotionJSX(EuiI18n, {
|
|
195
|
+
token: "euiColumnSelector.selectAll",
|
|
196
|
+
default: "Show all"
|
|
197
|
+
}))), ___EmotionJSX(EuiFlexItem, {
|
|
198
|
+
grow: false
|
|
199
|
+
}, ___EmotionJSX(EuiButtonEmpty, {
|
|
200
|
+
size: "xs",
|
|
201
|
+
flush: "right",
|
|
202
|
+
onClick: function onClick() {
|
|
203
|
+
return setVisibleColumns([]);
|
|
204
|
+
},
|
|
205
|
+
"data-test-subj": "dataGridColumnSelectorHideAllButton"
|
|
206
|
+
}, ___EmotionJSX(EuiI18n, {
|
|
207
|
+
token: "euiColumnSelector.hideAll",
|
|
208
|
+
default: "Hide all"
|
|
209
|
+
})))))) : null;
|
|
210
|
+
}, [availableColumns.length, numberOfHiddenFields, orderedVisibleColumns.length, allowColumnHiding, allowColumnReorder, isOpen, columnSearchText, displayValues, visibleColumnIds, sortedColumns, setVisibleColumns, setIsOpen, onDragEnd, isDragEnabled, dragHandleAriaLabel, filteredColumns]);
|
|
210
211
|
|
|
211
212
|
/**
|
|
212
213
|
* Used for moving columns left/right, available in the headers actions menu
|
|
@@ -222,5 +223,7 @@ export var useDataGridColumnSelector = function useDataGridColumnSelector(availa
|
|
|
222
223
|
nextSortedColumns.splice(moveToIdx, 0, fromColId);
|
|
223
224
|
setColumns(nextSortedColumns);
|
|
224
225
|
}, [setColumns, sortedColumns]);
|
|
225
|
-
return
|
|
226
|
+
return useMemo(function () {
|
|
227
|
+
return [columnSelector, orderedVisibleColumns, setVisibleColumns, switchColumnPos];
|
|
228
|
+
}, [columnSelector, orderedVisibleColumns, setVisibleColumns, switchColumnPos]);
|
|
226
229
|
};
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
2
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
4
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
5
|
+
var _excluded = ["sorting"];
|
|
3
6
|
/*
|
|
4
7
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
5
8
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
@@ -8,7 +11,7 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
|
8
11
|
* Side Public License, v 1.
|
|
9
12
|
*/
|
|
10
13
|
|
|
11
|
-
import React, { useEffect, useState } from 'react';
|
|
14
|
+
import React, { useEffect, useState, useMemo, useCallback, memo } from 'react';
|
|
12
15
|
import { EuiButtonEmpty } from '../../button';
|
|
13
16
|
import { EuiDragDropContext, euiDragDropReorder, EuiDroppable } from '../../drag_and_drop';
|
|
14
17
|
import { EuiFlexGroup, EuiFlexItem } from '../../flex';
|
|
@@ -20,79 +23,105 @@ import { EuiDataGridToolbarControl } from './data_grid_toolbar_control';
|
|
|
20
23
|
import { EuiDataGridColumnSortingDraggable } from './column_sorting_draggable';
|
|
21
24
|
import { getDetailsForSchema } from '../utils/data_grid_schema';
|
|
22
25
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
23
|
-
export var useDataGridColumnSorting = function useDataGridColumnSorting(
|
|
26
|
+
export var useDataGridColumnSorting = function useDataGridColumnSorting(_ref) {
|
|
27
|
+
var sorting = _ref.sorting,
|
|
28
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
29
|
+
return sorting == null ? null : ___EmotionJSX(DataGridSortingControl, _extends({
|
|
30
|
+
sorting: sorting
|
|
31
|
+
}, rest));
|
|
32
|
+
};
|
|
33
|
+
export var DataGridSortingControl = /*#__PURE__*/memo(function (_ref2) {
|
|
34
|
+
var columns = _ref2.columns,
|
|
35
|
+
sorting = _ref2.sorting,
|
|
36
|
+
schema = _ref2.schema,
|
|
37
|
+
schemaDetectors = _ref2.schemaDetectors,
|
|
38
|
+
displayValues = _ref2.displayValues;
|
|
24
39
|
var _useState = useState(false),
|
|
25
40
|
_useState2 = _slicedToArray(_useState, 2),
|
|
26
41
|
isOpen = _useState2[0],
|
|
27
42
|
setIsOpen = _useState2[1];
|
|
43
|
+
var sortingButtonText = useEuiI18n('euiColumnSorting.button', 'Sort fields');
|
|
44
|
+
var sortFieldAriaLabel = useEuiI18n('euiColumnSorting.sortFieldAriaLabel', 'Sort by: ');
|
|
28
45
|
var _useState3 = useState(false),
|
|
29
46
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
30
47
|
availableColumnsIsOpen = _useState4[0],
|
|
31
48
|
setAvailableColumnsIsOpen = _useState4[1];
|
|
49
|
+
var availableColumnIds = useMemo(function () {
|
|
50
|
+
return new Set(columns.map(function (_ref3) {
|
|
51
|
+
var id = _ref3.id;
|
|
52
|
+
return id;
|
|
53
|
+
}));
|
|
54
|
+
}, [columns]);
|
|
55
|
+
|
|
32
56
|
// prune any non-existent/hidden columns from sorting
|
|
33
57
|
useEffect(function () {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
var
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
}));
|
|
40
|
-
for (var i = 0; i < sorting.columns.length; i++) {
|
|
41
|
-
var column = sorting.columns[i];
|
|
42
|
-
if (availableColumnIds.has(column.id)) {
|
|
43
|
-
nextSortingColumns.push(column);
|
|
44
|
-
}
|
|
58
|
+
var nextSortingColumns = [];
|
|
59
|
+
for (var i = 0; i < sorting.columns.length; i++) {
|
|
60
|
+
var column = sorting.columns[i];
|
|
61
|
+
if (availableColumnIds.has(column.id)) {
|
|
62
|
+
nextSortingColumns.push(column);
|
|
45
63
|
}
|
|
64
|
+
}
|
|
46
65
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
}
|
|
66
|
+
// if the column array lengths differ then the sorting columns have been pruned
|
|
67
|
+
if (nextSortingColumns.length !== sorting.columns.length) {
|
|
68
|
+
sorting.onSort(nextSortingColumns);
|
|
51
69
|
}
|
|
52
|
-
}, [
|
|
53
|
-
var
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
}),
|
|
70
|
-
inactiveColumns =
|
|
71
|
-
var onDragEnd = function
|
|
72
|
-
var sourceIndex =
|
|
73
|
-
destination =
|
|
70
|
+
}, [availableColumnIds, sorting]);
|
|
71
|
+
var _useMemo = useMemo(function () {
|
|
72
|
+
var activeColumnIds = new Set(sorting.columns.map(function (_ref4) {
|
|
73
|
+
var id = _ref4.id;
|
|
74
|
+
return id;
|
|
75
|
+
}));
|
|
76
|
+
return columns.reduce(function (acc, column) {
|
|
77
|
+
if (activeColumnIds.has(column.id)) {
|
|
78
|
+
acc.activeColumns.push(column);
|
|
79
|
+
} else {
|
|
80
|
+
acc.inactiveColumns.push(column);
|
|
81
|
+
}
|
|
82
|
+
return acc;
|
|
83
|
+
}, {
|
|
84
|
+
activeColumns: [],
|
|
85
|
+
inactiveColumns: []
|
|
86
|
+
});
|
|
87
|
+
}, [columns, sorting]),
|
|
88
|
+
inactiveColumns = _useMemo.inactiveColumns;
|
|
89
|
+
var onDragEnd = useCallback(function (_ref5) {
|
|
90
|
+
var sourceIndex = _ref5.source.index,
|
|
91
|
+
destination = _ref5.destination;
|
|
74
92
|
if (destination) {
|
|
75
93
|
var destinationIndex = destination.index;
|
|
76
94
|
var nextColumns = euiDragDropReorder(sorting.columns, sourceIndex, destinationIndex);
|
|
77
95
|
sorting.onSort(nextColumns);
|
|
78
96
|
}
|
|
79
|
-
};
|
|
80
|
-
var schemaDetails = function
|
|
97
|
+
}, [sorting]);
|
|
98
|
+
var schemaDetails = useCallback(function (id) {
|
|
81
99
|
return schema.hasOwnProperty(id) && schema[id].columnType != null ? getDetailsForSchema(schemaDetectors, schema[id].columnType) : null;
|
|
82
|
-
};
|
|
83
|
-
var inactiveSortableColumns =
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
100
|
+
}, [schema, schemaDetectors]);
|
|
101
|
+
var inactiveSortableColumns = useMemo(function () {
|
|
102
|
+
return inactiveColumns.filter(function (_ref6) {
|
|
103
|
+
var id = _ref6.id,
|
|
104
|
+
isSortable = _ref6.isSortable;
|
|
105
|
+
var schemaDetail = schemaDetails(id);
|
|
106
|
+
var sortable = true;
|
|
107
|
+
if (isSortable != null) {
|
|
108
|
+
sortable = isSortable;
|
|
109
|
+
} else if (schemaDetail != null) {
|
|
110
|
+
sortable = schemaDetail.hasOwnProperty('isSortable') ? schemaDetail.isSortable : true;
|
|
111
|
+
}
|
|
112
|
+
return sortable;
|
|
113
|
+
});
|
|
114
|
+
}, [inactiveColumns, schemaDetails]);
|
|
115
|
+
var onButtonClick = useCallback(function (id, defaultSortDirection) {
|
|
116
|
+
var _schemaDetails;
|
|
117
|
+
var nextColumns = _toConsumableArray(sorting.columns);
|
|
118
|
+
nextColumns.push({
|
|
119
|
+
id: id,
|
|
120
|
+
direction: defaultSortDirection || ((_schemaDetails = schemaDetails(id)) === null || _schemaDetails === void 0 ? void 0 : _schemaDetails.defaultSortDirection) || 'asc'
|
|
121
|
+
});
|
|
122
|
+
sorting.onSort(nextColumns);
|
|
123
|
+
}, [sorting, schemaDetails]);
|
|
124
|
+
return ___EmotionJSX(EuiPopover, {
|
|
96
125
|
"data-test-subj": "dataGridColumnSortingPopover",
|
|
97
126
|
isOpen: isOpen,
|
|
98
127
|
closePopover: function closePopover() {
|
|
@@ -114,9 +143,9 @@ export var useDataGridColumnSorting = function useDataGridColumnSorting(columns,
|
|
|
114
143
|
}, ___EmotionJSX(EuiDroppable, {
|
|
115
144
|
droppableId: "columnSorting",
|
|
116
145
|
className: "euiDataGrid__controlScroll"
|
|
117
|
-
}, ___EmotionJSX(React.Fragment, null, sorting.columns.map(function (
|
|
118
|
-
var id =
|
|
119
|
-
direction =
|
|
146
|
+
}, ___EmotionJSX(React.Fragment, null, sorting.columns.map(function (_ref7, index) {
|
|
147
|
+
var id = _ref7.id,
|
|
148
|
+
direction = _ref7.direction;
|
|
120
149
|
return ___EmotionJSX(EuiDataGridColumnSortingDraggable, {
|
|
121
150
|
key: id,
|
|
122
151
|
id: id,
|
|
@@ -162,49 +191,38 @@ export var useDataGridColumnSorting = function useDataGridColumnSorting(columns,
|
|
|
162
191
|
token: "euiColumnSorting.pickFields",
|
|
163
192
|
default: "Pick fields to sort by"
|
|
164
193
|
}))
|
|
165
|
-
}, ___EmotionJSX(
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
}, function (
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
grow: false
|
|
198
|
-
}, ___EmotionJSX(EuiToken, {
|
|
199
|
-
iconType: schemaDetails(id) != null ? getDetailsForSchema(schemaDetectors, schema[id].columnType).icon : 'tokenString',
|
|
200
|
-
color: schemaDetails(id) != null ? getDetailsForSchema(schemaDetectors, schema[id].columnType).color : undefined
|
|
201
|
-
})), ___EmotionJSX(EuiFlexItem, {
|
|
202
|
-
grow: false
|
|
203
|
-
}, ___EmotionJSX(EuiText, {
|
|
204
|
-
size: "xs"
|
|
205
|
-
}, displayValues[id]))));
|
|
206
|
-
}));
|
|
207
|
-
}))), sorting.columns.length > 0 ? ___EmotionJSX(EuiFlexItem, {
|
|
194
|
+
}, ___EmotionJSX("div", {
|
|
195
|
+
className: "euiDataGridColumnSorting__fieldList",
|
|
196
|
+
role: "listbox"
|
|
197
|
+
}, inactiveSortableColumns.map(function (_ref8) {
|
|
198
|
+
var id = _ref8.id,
|
|
199
|
+
defaultSortDirection = _ref8.defaultSortDirection;
|
|
200
|
+
return ___EmotionJSX("button", {
|
|
201
|
+
key: id,
|
|
202
|
+
className: "euiDataGridColumnSorting__field",
|
|
203
|
+
"aria-label": "".concat(sortFieldAriaLabel, " ").concat(id),
|
|
204
|
+
role: "option",
|
|
205
|
+
"aria-selected": "false",
|
|
206
|
+
"data-test-subj": "dataGridColumnSortingPopoverColumnSelection-".concat(id),
|
|
207
|
+
onClick: function onClick() {
|
|
208
|
+
return onButtonClick(id, defaultSortDirection);
|
|
209
|
+
}
|
|
210
|
+
}, ___EmotionJSX(EuiFlexGroup, {
|
|
211
|
+
alignItems: "center",
|
|
212
|
+
gutterSize: "s",
|
|
213
|
+
component: "span",
|
|
214
|
+
responsive: false
|
|
215
|
+
}, ___EmotionJSX(EuiFlexItem, {
|
|
216
|
+
grow: false
|
|
217
|
+
}, ___EmotionJSX(EuiToken, {
|
|
218
|
+
iconType: schemaDetails(id) != null ? getDetailsForSchema(schemaDetectors, schema[id].columnType).icon : 'tokenString',
|
|
219
|
+
color: schemaDetails(id) != null ? getDetailsForSchema(schemaDetectors, schema[id].columnType).color : undefined
|
|
220
|
+
})), ___EmotionJSX(EuiFlexItem, {
|
|
221
|
+
grow: false
|
|
222
|
+
}, ___EmotionJSX(EuiText, {
|
|
223
|
+
size: "xs"
|
|
224
|
+
}, displayValues[id]))));
|
|
225
|
+
})))), sorting.columns.length > 0 ? ___EmotionJSX(EuiFlexItem, {
|
|
208
226
|
grow: false
|
|
209
227
|
}, ___EmotionJSX(EuiButtonEmpty, {
|
|
210
228
|
size: "xs",
|
|
@@ -217,5 +235,5 @@ export var useDataGridColumnSorting = function useDataGridColumnSorting(columns,
|
|
|
217
235
|
token: "euiColumnSorting.clearAll",
|
|
218
236
|
default: "Clear sorting"
|
|
219
237
|
}))) : null)));
|
|
220
|
-
|
|
221
|
-
|
|
238
|
+
});
|
|
239
|
+
DataGridSortingControl.displayName = 'DataGridSortingControl';
|
|
@@ -10,7 +10,7 @@ var _excluded = ["id", "display", "direction", "index", "sorting", "schema", "sc
|
|
|
10
10
|
* Side Public License, v 1.
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
import React from 'react';
|
|
13
|
+
import React, { useCallback } from 'react';
|
|
14
14
|
import classNames from 'classnames';
|
|
15
15
|
import { EuiScreenReaderOnly } from '../../accessibility';
|
|
16
16
|
import { EuiButtonGroup, EuiButtonIcon } from '../../button';
|
|
@@ -54,6 +54,27 @@ export var EuiDataGridColumnSortingDraggable = function EuiDataGridColumnSorting
|
|
|
54
54
|
'data-test-subj': "euiDataGridColumnSorting-sortColumn-".concat(id, "-desc")
|
|
55
55
|
}];
|
|
56
56
|
var dragHandleAriaLabel = useEuiI18n('euiColumnSortingDraggable.dragHandleAriaLabel', 'Drag handle');
|
|
57
|
+
var removeSort = useCallback(function () {
|
|
58
|
+
var nextColumns = _toConsumableArray(sorting.columns);
|
|
59
|
+
var columnIndex = nextColumns.map(function (_ref2) {
|
|
60
|
+
var id = _ref2.id;
|
|
61
|
+
return id;
|
|
62
|
+
}).indexOf(id);
|
|
63
|
+
nextColumns.splice(columnIndex, 1);
|
|
64
|
+
sorting.onSort(nextColumns);
|
|
65
|
+
}, [id, sorting]);
|
|
66
|
+
var toggleLegendHandler = useCallback(function (_, direction) {
|
|
67
|
+
var nextColumns = _toConsumableArray(sorting.columns);
|
|
68
|
+
var columnIndex = nextColumns.map(function (_ref3) {
|
|
69
|
+
var id = _ref3.id;
|
|
70
|
+
return id;
|
|
71
|
+
}).indexOf(id);
|
|
72
|
+
nextColumns.splice(columnIndex, 1, {
|
|
73
|
+
id: id,
|
|
74
|
+
direction: direction
|
|
75
|
+
});
|
|
76
|
+
sorting.onSort(nextColumns);
|
|
77
|
+
}, [id, sorting]);
|
|
57
78
|
return ___EmotionJSX(EuiDraggable, _extends({
|
|
58
79
|
draggableId: id,
|
|
59
80
|
index: index,
|
|
@@ -91,15 +112,7 @@ export var EuiDataGridColumnSortingDraggable = function EuiDataGridColumnSorting
|
|
|
91
112
|
className: "euiDataGridColumnSorting__button",
|
|
92
113
|
"aria-label": removeSortLabel,
|
|
93
114
|
iconType: "cross",
|
|
94
|
-
onClick:
|
|
95
|
-
var nextColumns = _toConsumableArray(sorting.columns);
|
|
96
|
-
var columnIndex = nextColumns.map(function (_ref2) {
|
|
97
|
-
var id = _ref2.id;
|
|
98
|
-
return id;
|
|
99
|
-
}).indexOf(id);
|
|
100
|
-
nextColumns.splice(columnIndex, 1);
|
|
101
|
-
sorting.onSort(nextColumns);
|
|
102
|
-
}
|
|
115
|
+
onClick: removeSort
|
|
103
116
|
});
|
|
104
117
|
})), ___EmotionJSX(EuiFlexItem, _extends({
|
|
105
118
|
className: "euiDataGridColumnSorting__name"
|
|
@@ -134,18 +147,7 @@ export var EuiDataGridColumnSortingDraggable = function EuiDataGridColumnSorting
|
|
|
134
147
|
buttonSize: "compressed",
|
|
135
148
|
className: "euiDataGridColumnSorting__order",
|
|
136
149
|
idSelected: direction === 'asc' ? "".concat(id, "Asc") : "".concat(id, "Desc"),
|
|
137
|
-
onChange:
|
|
138
|
-
var nextColumns = _toConsumableArray(sorting.columns);
|
|
139
|
-
var columnIndex = nextColumns.map(function (_ref3) {
|
|
140
|
-
var id = _ref3.id;
|
|
141
|
-
return id;
|
|
142
|
-
}).indexOf(id);
|
|
143
|
-
nextColumns.splice(columnIndex, 1, {
|
|
144
|
-
id: id,
|
|
145
|
-
direction: direction
|
|
146
|
-
});
|
|
147
|
-
sorting.onSort(nextColumns);
|
|
148
|
-
}
|
|
150
|
+
onChange: toggleLegendHandler
|
|
149
151
|
});
|
|
150
152
|
})), ___EmotionJSX(EuiFlexItem, _extends({
|
|
151
153
|
grow: false
|