@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
|
@@ -16,7 +16,7 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
16
16
|
* Side Public License, v 1.
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
|
-
import React from 'react';
|
|
19
|
+
import React, { useCallback } from 'react';
|
|
20
20
|
import PropTypes from "prop-types";
|
|
21
21
|
import classNames from 'classnames';
|
|
22
22
|
import { EuiScreenReaderOnly } from '../../accessibility';
|
|
@@ -61,6 +61,27 @@ export var EuiDataGridColumnSortingDraggable = function EuiDataGridColumnSorting
|
|
|
61
61
|
'data-test-subj': "euiDataGridColumnSorting-sortColumn-".concat(id, "-desc")
|
|
62
62
|
}];
|
|
63
63
|
var dragHandleAriaLabel = useEuiI18n('euiColumnSortingDraggable.dragHandleAriaLabel', 'Drag handle');
|
|
64
|
+
var removeSort = useCallback(function () {
|
|
65
|
+
var nextColumns = _toConsumableArray(sorting.columns);
|
|
66
|
+
var columnIndex = nextColumns.map(function (_ref2) {
|
|
67
|
+
var id = _ref2.id;
|
|
68
|
+
return id;
|
|
69
|
+
}).indexOf(id);
|
|
70
|
+
nextColumns.splice(columnIndex, 1);
|
|
71
|
+
sorting.onSort(nextColumns);
|
|
72
|
+
}, [id, sorting]);
|
|
73
|
+
var toggleLegendHandler = useCallback(function (_, direction) {
|
|
74
|
+
var nextColumns = _toConsumableArray(sorting.columns);
|
|
75
|
+
var columnIndex = nextColumns.map(function (_ref3) {
|
|
76
|
+
var id = _ref3.id;
|
|
77
|
+
return id;
|
|
78
|
+
}).indexOf(id);
|
|
79
|
+
nextColumns.splice(columnIndex, 1, {
|
|
80
|
+
id: id,
|
|
81
|
+
direction: direction
|
|
82
|
+
});
|
|
83
|
+
sorting.onSort(nextColumns);
|
|
84
|
+
}, [id, sorting]);
|
|
64
85
|
return ___EmotionJSX(EuiDraggable, _extends({
|
|
65
86
|
draggableId: id,
|
|
66
87
|
index: index,
|
|
@@ -98,15 +119,7 @@ export var EuiDataGridColumnSortingDraggable = function EuiDataGridColumnSorting
|
|
|
98
119
|
className: "euiDataGridColumnSorting__button",
|
|
99
120
|
"aria-label": removeSortLabel,
|
|
100
121
|
iconType: "cross",
|
|
101
|
-
onClick:
|
|
102
|
-
var nextColumns = _toConsumableArray(sorting.columns);
|
|
103
|
-
var columnIndex = nextColumns.map(function (_ref2) {
|
|
104
|
-
var id = _ref2.id;
|
|
105
|
-
return id;
|
|
106
|
-
}).indexOf(id);
|
|
107
|
-
nextColumns.splice(columnIndex, 1);
|
|
108
|
-
sorting.onSort(nextColumns);
|
|
109
|
-
}
|
|
122
|
+
onClick: removeSort
|
|
110
123
|
});
|
|
111
124
|
})), ___EmotionJSX(EuiFlexItem, _extends({
|
|
112
125
|
className: "euiDataGridColumnSorting__name"
|
|
@@ -141,18 +154,7 @@ export var EuiDataGridColumnSortingDraggable = function EuiDataGridColumnSorting
|
|
|
141
154
|
buttonSize: "compressed",
|
|
142
155
|
className: "euiDataGridColumnSorting__order",
|
|
143
156
|
idSelected: direction === 'asc' ? "".concat(id, "Asc") : "".concat(id, "Desc"),
|
|
144
|
-
onChange:
|
|
145
|
-
var nextColumns = _toConsumableArray(sorting.columns);
|
|
146
|
-
var columnIndex = nextColumns.map(function (_ref3) {
|
|
147
|
-
var id = _ref3.id;
|
|
148
|
-
return id;
|
|
149
|
-
}).indexOf(id);
|
|
150
|
-
nextColumns.splice(columnIndex, 1, {
|
|
151
|
-
id: id,
|
|
152
|
-
direction: direction
|
|
153
|
-
});
|
|
154
|
-
sorting.onSort(nextColumns);
|
|
155
|
-
}
|
|
157
|
+
onChange: toggleLegendHandler
|
|
156
158
|
});
|
|
157
159
|
})), ___EmotionJSX(EuiFlexItem, _extends({
|
|
158
160
|
grow: false
|
|
@@ -203,113 +203,115 @@ export var useDataGridDisplaySelector = function useDataGridDisplaySelector(show
|
|
|
203
203
|
}, []);
|
|
204
204
|
var buttonLabel = useEuiI18n('euiDisplaySelector.buttonText', 'Display options');
|
|
205
205
|
var resetButtonLabel = useEuiI18n('euiDisplaySelector.resetButtonText', 'Reset to default');
|
|
206
|
-
var displaySelector =
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
anchorPosition: "downRight",
|
|
213
|
-
panelPaddingSize: "s",
|
|
214
|
-
panelClassName: "euiDataGrid__displayPopoverPanel",
|
|
215
|
-
button: ___EmotionJSX(EuiToolTip, {
|
|
216
|
-
content: buttonLabel,
|
|
217
|
-
delay: "long"
|
|
218
|
-
}, ___EmotionJSX(EuiButtonIcon, {
|
|
219
|
-
size: "xs",
|
|
220
|
-
iconType: "controlsHorizontal",
|
|
221
|
-
color: "text",
|
|
222
|
-
"data-test-subj": "dataGridDisplaySelectorButton",
|
|
223
|
-
onClick: function onClick() {
|
|
224
|
-
return setIsOpen(!isOpen);
|
|
206
|
+
var displaySelector = useMemo(function () {
|
|
207
|
+
return showDensityControls || showRowHeightControls || additionalDisplaySettings ? ___EmotionJSX(EuiPopover, {
|
|
208
|
+
"data-test-subj": "dataGridDisplaySelectorPopover",
|
|
209
|
+
isOpen: isOpen,
|
|
210
|
+
closePopover: function closePopover() {
|
|
211
|
+
return setIsOpen(false);
|
|
225
212
|
},
|
|
226
|
-
"
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
label:
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
label:
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
213
|
+
anchorPosition: "downRight",
|
|
214
|
+
panelPaddingSize: "s",
|
|
215
|
+
panelClassName: "euiDataGrid__displayPopoverPanel",
|
|
216
|
+
button: ___EmotionJSX(EuiToolTip, {
|
|
217
|
+
content: buttonLabel,
|
|
218
|
+
delay: "long"
|
|
219
|
+
}, ___EmotionJSX(EuiButtonIcon, {
|
|
220
|
+
size: "xs",
|
|
221
|
+
iconType: "controlsHorizontal",
|
|
222
|
+
color: "text",
|
|
223
|
+
"data-test-subj": "dataGridDisplaySelectorButton",
|
|
224
|
+
onClick: function onClick() {
|
|
225
|
+
return setIsOpen(!isOpen);
|
|
226
|
+
},
|
|
227
|
+
"aria-label": buttonLabel
|
|
228
|
+
}))
|
|
229
|
+
}, showDensityControls && ___EmotionJSX(EuiI18n, {
|
|
230
|
+
tokens: ['euiDisplaySelector.densityLabel', 'euiDisplaySelector.labelCompact', 'euiDisplaySelector.labelNormal', 'euiDisplaySelector.labelExpanded'],
|
|
231
|
+
defaults: ['Density', 'Compact', 'Normal', 'Expanded']
|
|
232
|
+
}, function (_ref) {
|
|
233
|
+
var _ref2 = _slicedToArray(_ref, 4),
|
|
234
|
+
densityLabel = _ref2[0],
|
|
235
|
+
labelCompact = _ref2[1],
|
|
236
|
+
labelNormal = _ref2[2],
|
|
237
|
+
labelExpanded = _ref2[3];
|
|
238
|
+
return ___EmotionJSX(EuiFormRow, {
|
|
239
|
+
label: densityLabel,
|
|
240
|
+
display: "columnCompressed"
|
|
241
|
+
}, ___EmotionJSX(EuiButtonGroup, {
|
|
242
|
+
legend: densityLabel,
|
|
243
|
+
buttonSize: "compressed",
|
|
244
|
+
isFullWidth: true,
|
|
245
|
+
options: [{
|
|
246
|
+
id: densityOptions[0],
|
|
247
|
+
label: labelCompact
|
|
248
|
+
}, {
|
|
249
|
+
id: densityOptions[1],
|
|
250
|
+
label: labelNormal
|
|
251
|
+
}, {
|
|
252
|
+
id: densityOptions[2],
|
|
253
|
+
label: labelExpanded
|
|
254
|
+
}],
|
|
255
|
+
onChange: setGridStyles,
|
|
256
|
+
idSelected: gridDensity,
|
|
257
|
+
"data-test-subj": "densityButtonGroup"
|
|
258
|
+
}));
|
|
259
|
+
}), showRowHeightControls && ___EmotionJSX(EuiI18n, {
|
|
260
|
+
tokens: ['euiDisplaySelector.rowHeightLabel', 'euiDisplaySelector.labelSingle', 'euiDisplaySelector.labelAuto', 'euiDisplaySelector.labelCustom', 'euiDisplaySelector.lineCountLabel'],
|
|
261
|
+
defaults: ['Row height', 'Single', 'Auto fit', 'Custom', 'Lines per row']
|
|
262
|
+
}, function (_ref3) {
|
|
263
|
+
var _ref4 = _slicedToArray(_ref3, 5),
|
|
264
|
+
rowHeightLabel = _ref4[0],
|
|
265
|
+
labelSingle = _ref4[1],
|
|
266
|
+
labelAuto = _ref4[2],
|
|
267
|
+
labelCustom = _ref4[3],
|
|
268
|
+
lineCountLabel = _ref4[4];
|
|
269
|
+
return ___EmotionJSX(React.Fragment, null, ___EmotionJSX(EuiFormRow, {
|
|
270
|
+
label: rowHeightLabel,
|
|
271
|
+
display: "columnCompressed"
|
|
272
|
+
}, ___EmotionJSX(EuiButtonGroup, {
|
|
273
|
+
legend: rowHeightLabel,
|
|
274
|
+
buttonSize: "compressed",
|
|
275
|
+
isFullWidth: true,
|
|
276
|
+
options: [{
|
|
277
|
+
id: rowHeightButtonOptions[0],
|
|
278
|
+
label: labelSingle
|
|
279
|
+
}, {
|
|
280
|
+
id: rowHeightButtonOptions[1],
|
|
281
|
+
label: labelAuto
|
|
282
|
+
}, {
|
|
283
|
+
id: rowHeightButtonOptions[2],
|
|
284
|
+
label: labelCustom
|
|
285
|
+
}],
|
|
286
|
+
onChange: setRowHeight,
|
|
287
|
+
idSelected: rowHeightSelection,
|
|
288
|
+
"data-test-subj": "rowHeightButtonGroup"
|
|
289
|
+
})), rowHeightSelection === rowHeightButtonOptions[2] && ___EmotionJSX(EuiFormRow, {
|
|
290
|
+
label: lineCountLabel,
|
|
291
|
+
display: "columnCompressed"
|
|
292
|
+
}, ___EmotionJSX(EuiRange, {
|
|
293
|
+
compressed: true,
|
|
294
|
+
fullWidth: true,
|
|
295
|
+
showInput: true,
|
|
296
|
+
min: 1,
|
|
297
|
+
max: 20,
|
|
298
|
+
step: 1,
|
|
299
|
+
required: true,
|
|
300
|
+
value: lineCountInput,
|
|
301
|
+
onChange: setLineCountHeight,
|
|
302
|
+
"data-test-subj": "lineCountNumber"
|
|
303
|
+
})));
|
|
304
|
+
}), additionalDisplaySettings, showResetButton && ___EmotionJSX(EuiPopoverFooter, null, ___EmotionJSX(EuiFlexGroup, {
|
|
305
|
+
justifyContent: "flexEnd",
|
|
306
|
+
responsive: false
|
|
307
|
+
}, ___EmotionJSX(EuiFlexItem, {
|
|
308
|
+
grow: false
|
|
309
|
+
}, ___EmotionJSX("div", null, ___EmotionJSX(EuiButtonEmpty, {
|
|
310
|
+
flush: "both",
|
|
311
|
+
size: "xs",
|
|
312
|
+
onClick: resetToInitialState,
|
|
313
|
+
"data-test-subj": "resetDisplaySelector"
|
|
314
|
+
}, resetButtonLabel)))))) : null;
|
|
315
|
+
}, [additionalDisplaySettings, buttonLabel, isOpen, resetButtonLabel, showDensityControls, showResetButton, showRowHeightControls, gridDensity, rowHeightSelection, lineCountInput, setGridStyles, setRowHeight, setLineCountHeight, resetToInitialState]);
|
|
314
316
|
return [displaySelector, gridStyles, rowHeightsOptions];
|
|
315
317
|
};
|
|
@@ -74,9 +74,19 @@ var commaSeparateNumbers = function commaSeparateNumbers(numberString) {
|
|
|
74
74
|
);
|
|
75
75
|
});
|
|
76
76
|
};
|
|
77
|
+
var renderCellValue = function renderCellValue(_ref2) {
|
|
78
|
+
var rowIndex = _ref2.rowIndex,
|
|
79
|
+
columnId = _ref2.columnId,
|
|
80
|
+
schema = _ref2.schema;
|
|
81
|
+
var value = storeData[rowIndex][columnId];
|
|
82
|
+
if (schema === 'numeric') {
|
|
83
|
+
value = commaSeparateNumbers(value);
|
|
84
|
+
}
|
|
85
|
+
return value;
|
|
86
|
+
};
|
|
77
87
|
var DataGrid = function DataGrid() {
|
|
78
|
-
var _useState = useState(columns.map(function (
|
|
79
|
-
var id =
|
|
88
|
+
var _useState = useState(columns.map(function (_ref3) {
|
|
89
|
+
var id = _ref3.id;
|
|
80
90
|
return id;
|
|
81
91
|
})),
|
|
82
92
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -118,16 +128,7 @@ var DataGrid = function DataGrid() {
|
|
|
118
128
|
inMemory: {
|
|
119
129
|
level: 'sorting'
|
|
120
130
|
},
|
|
121
|
-
renderCellValue:
|
|
122
|
-
var rowIndex = _ref3.rowIndex,
|
|
123
|
-
columnId = _ref3.columnId,
|
|
124
|
-
schema = _ref3.schema;
|
|
125
|
-
var value = data[rowIndex][columnId];
|
|
126
|
-
if (schema === 'numeric') {
|
|
127
|
-
value = commaSeparateNumbers(value);
|
|
128
|
-
}
|
|
129
|
-
return value;
|
|
130
|
-
},
|
|
131
|
+
renderCellValue: renderCellValue,
|
|
131
132
|
sorting: {
|
|
132
133
|
columns: sortingColumns,
|
|
133
134
|
onSort: setSorting
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
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); }
|
|
2
|
-
var _excluded = ["leadingControlColumns", "trailingControlColumns", "columns", "columnVisibility", "schemaDetectors", "rowCount", "renderCellValue", "cellContext", "renderCellPopover", "renderFooterCellValue", "className", "gridStyle", "toolbarVisibility", "pagination", "sorting", "inMemory", "onColumnResize", "minSizeForControls", "height", "width", "rowHeightsOptions", "virtualizationOptions", "renderCustomGridBody", "renderCustomToolbar"]
|
|
3
|
-
_excluded2 = ["focusProps"];
|
|
2
|
+
var _excluded = ["leadingControlColumns", "trailingControlColumns", "columns", "columnVisibility", "schemaDetectors", "rowCount", "renderCellValue", "cellContext", "renderCellPopover", "renderFooterCellValue", "className", "gridStyle", "toolbarVisibility", "pagination", "sorting", "inMemory", "onColumnResize", "minSizeForControls", "height", "width", "rowHeightsOptions", "virtualizationOptions", "renderCustomGridBody", "renderCustomToolbar"];
|
|
4
3
|
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); }
|
|
5
4
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
6
5
|
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
@@ -28,7 +27,7 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
28
27
|
*/
|
|
29
28
|
|
|
30
29
|
import classNames from 'classnames';
|
|
31
|
-
import React, { forwardRef, useMemo, useRef, useState, memo } from 'react';
|
|
30
|
+
import React, { forwardRef, useMemo, useRef, useState, memo, useCallback } from 'react';
|
|
32
31
|
import { useGeneratedHtmlId } from '../../services';
|
|
33
32
|
import { useEuiTablePaginationDefaults } from '../table/table_pagination';
|
|
34
33
|
import { EuiFocusTrap } from '../focus_trap';
|
|
@@ -37,7 +36,7 @@ import { useMutationObserver } from '../observer/mutation_observer';
|
|
|
37
36
|
import { useResizeObserver } from '../observer/resize_observer';
|
|
38
37
|
import { EuiDataGridBody } from './body';
|
|
39
38
|
import { useDataGridColumnSelector, useDataGridColumnSorting, useDataGridDisplaySelector, startingStyles, useDataGridFullScreenSelector, useDataGridKeyboardShortcuts, checkOrDefaultToolBarDisplayOptions, EuiDataGridToolbar } from './controls';
|
|
40
|
-
import {
|
|
39
|
+
import { DataGridSortedContext, useSorting } from './utils/sorting';
|
|
41
40
|
import { DataGridFocusContext, useFocus, createKeyDownHandler, preventTabbing } from './utils/focus';
|
|
42
41
|
import { useInMemoryValues, EuiDataGridInMemoryRenderer } from './utils/in_memory';
|
|
43
42
|
import { DataGridCellPopoverContext, useCellPopover } from './body/cell';
|
|
@@ -77,8 +76,8 @@ var cellPaddingsToClassMap = {
|
|
|
77
76
|
m: '',
|
|
78
77
|
l: 'euiDataGrid--paddingLarge'
|
|
79
78
|
};
|
|
79
|
+
var emptyVirtualizationOptions = {};
|
|
80
80
|
export var EuiDataGrid = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function (props, ref) {
|
|
81
|
-
var _gridItemsRendered$cu;
|
|
82
81
|
var _props$leadingControl = props.leadingControlColumns,
|
|
83
82
|
leadingControlColumns = _props$leadingControl === void 0 ? emptyControlColumns : _props$leadingControl,
|
|
84
83
|
_props$trailingContro = props.trailingControlColumns,
|
|
@@ -198,8 +197,14 @@ export var EuiDataGrid = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function (pr
|
|
|
198
197
|
/**
|
|
199
198
|
* Sorting
|
|
200
199
|
*/
|
|
201
|
-
var columnSorting = useDataGridColumnSorting(
|
|
202
|
-
|
|
200
|
+
var columnSorting = useDataGridColumnSorting({
|
|
201
|
+
sorting: sorting,
|
|
202
|
+
columns: orderedVisibleColumns,
|
|
203
|
+
displayValues: displayValues,
|
|
204
|
+
schema: mergedSchema,
|
|
205
|
+
schemaDetectors: allSchemaDetectors
|
|
206
|
+
});
|
|
207
|
+
var sortedContext = useSorting({
|
|
203
208
|
sorting: sorting,
|
|
204
209
|
inMemory: inMemory,
|
|
205
210
|
inMemoryValues: inMemoryValues,
|
|
@@ -213,7 +218,20 @@ export var EuiDataGrid = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function (pr
|
|
|
213
218
|
*/
|
|
214
219
|
var _useFocus = useFocus(),
|
|
215
220
|
wrappingDivFocusProps = _useFocus.focusProps,
|
|
216
|
-
|
|
221
|
+
onFocusUpdate = _useFocus.onFocusUpdate,
|
|
222
|
+
focusedCell = _useFocus.focusedCell,
|
|
223
|
+
setFocusedCell = _useFocus.setFocusedCell,
|
|
224
|
+
setIsFocusedCellInView = _useFocus.setIsFocusedCellInView,
|
|
225
|
+
focusFirstVisibleInteractiveCell = _useFocus.focusFirstVisibleInteractiveCell;
|
|
226
|
+
var focusContext = useMemo(function () {
|
|
227
|
+
return {
|
|
228
|
+
onFocusUpdate: onFocusUpdate,
|
|
229
|
+
focusedCell: focusedCell,
|
|
230
|
+
setFocusedCell: setFocusedCell,
|
|
231
|
+
setIsFocusedCellInView: setIsFocusedCellInView,
|
|
232
|
+
focusFirstVisibleInteractiveCell: focusFirstVisibleInteractiveCell
|
|
233
|
+
};
|
|
234
|
+
}, [onFocusUpdate, focusedCell, setFocusedCell, setIsFocusedCellInView, focusFirstVisibleInteractiveCell]);
|
|
217
235
|
|
|
218
236
|
/**
|
|
219
237
|
* Cell popover
|
|
@@ -243,7 +261,7 @@ export var EuiDataGrid = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function (pr
|
|
|
243
261
|
setIsFullScreen: setIsFullScreen,
|
|
244
262
|
focusContext: focusContext,
|
|
245
263
|
cellPopoverContext: cellPopoverContext,
|
|
246
|
-
|
|
264
|
+
sortedContext: sortedContext,
|
|
247
265
|
pagination: pagination,
|
|
248
266
|
rowCount: rowCount,
|
|
249
267
|
visibleColCount: visibleColCount
|
|
@@ -290,12 +308,25 @@ export var EuiDataGrid = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function (pr
|
|
|
290
308
|
gridAriaProps['aria-labelledby'] = "".concat(rest['aria-labelledby'], " ").concat(pagination ? ariaLabelledById : '');
|
|
291
309
|
delete rest['aria-labelledby'];
|
|
292
310
|
}
|
|
311
|
+
var onKeyDown = useCallback(function (event) {
|
|
312
|
+
var _gridItemsRendered$cu;
|
|
313
|
+
createKeyDownHandler({
|
|
314
|
+
gridElement: contentRef.current,
|
|
315
|
+
visibleColCount: visibleColCount,
|
|
316
|
+
visibleRowCount: visibleRowCount,
|
|
317
|
+
visibleRowStartIndex: ((_gridItemsRendered$cu = gridItemsRendered.current) === null || _gridItemsRendered$cu === void 0 ? void 0 : _gridItemsRendered$cu.visibleRowStartIndex) || 0,
|
|
318
|
+
rowCount: rowCount,
|
|
319
|
+
pagination: pagination,
|
|
320
|
+
hasFooter: !!renderFooterCellValue,
|
|
321
|
+
focusContext: focusContext
|
|
322
|
+
})(event);
|
|
323
|
+
}, [focusContext, visibleColCount, visibleRowCount, rowCount, pagination, renderFooterCellValue]);
|
|
293
324
|
return ___EmotionJSX(DataGridFocusContext.Provider, {
|
|
294
325
|
value: focusContext
|
|
295
326
|
}, ___EmotionJSX(DataGridCellPopoverContext.Provider, {
|
|
296
327
|
value: cellPopoverContext
|
|
297
|
-
}, ___EmotionJSX(
|
|
298
|
-
value:
|
|
328
|
+
}, ___EmotionJSX(DataGridSortedContext.Provider, {
|
|
329
|
+
value: sortedContext
|
|
299
330
|
}, ___EmotionJSX(EuiFocusTrap, {
|
|
300
331
|
disabled: !isFullScreen,
|
|
301
332
|
className: "euiDataGrid__focusWrap"
|
|
@@ -331,16 +362,7 @@ export var EuiDataGrid = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function (pr
|
|
|
331
362
|
}) : null, ___EmotionJSX("div", _extends({
|
|
332
363
|
// eslint-disable-line jsx-a11y/interactive-supports-focus
|
|
333
364
|
ref: contentRef,
|
|
334
|
-
onKeyDown:
|
|
335
|
-
gridElement: contentRef.current,
|
|
336
|
-
visibleColCount: visibleColCount,
|
|
337
|
-
visibleRowCount: visibleRowCount,
|
|
338
|
-
visibleRowStartIndex: ((_gridItemsRendered$cu = gridItemsRendered.current) === null || _gridItemsRendered$cu === void 0 ? void 0 : _gridItemsRendered$cu.visibleRowStartIndex) || 0,
|
|
339
|
-
rowCount: rowCount,
|
|
340
|
-
pagination: pagination,
|
|
341
|
-
hasFooter: !!renderFooterCellValue,
|
|
342
|
-
focusContext: focusContext
|
|
343
|
-
}),
|
|
365
|
+
onKeyDown: onKeyDown,
|
|
344
366
|
"data-test-subj": "euiDataGridBody",
|
|
345
367
|
className: "euiDataGrid__content",
|
|
346
368
|
role: "grid",
|
|
@@ -356,6 +378,7 @@ export var EuiDataGrid = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function (pr
|
|
|
356
378
|
switchColumnPos: switchColumnPos,
|
|
357
379
|
onColumnResize: onColumnResize,
|
|
358
380
|
schemaDetectors: allSchemaDetectors,
|
|
381
|
+
sorting: sorting,
|
|
359
382
|
pagination: pagination,
|
|
360
383
|
renderCellValue: renderCellValue,
|
|
361
384
|
cellContext: cellContext,
|
|
@@ -365,7 +388,7 @@ export var EuiDataGrid = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function (pr
|
|
|
365
388
|
visibleRows: visibleRows,
|
|
366
389
|
interactiveCellId: interactiveCellId,
|
|
367
390
|
rowHeightsOptions: rowHeightsOptions,
|
|
368
|
-
virtualizationOptions: virtualizationOptions ||
|
|
391
|
+
virtualizationOptions: virtualizationOptions || emptyVirtualizationOptions,
|
|
369
392
|
isFullScreen: isFullScreen,
|
|
370
393
|
gridStyles: gridStyles,
|
|
371
394
|
gridWidth: gridWidth,
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
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); }
|
|
2
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
3
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
4
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
5
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
2
6
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
3
7
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
4
8
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5
9
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
6
10
|
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
7
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
8
|
-
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
9
|
-
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
10
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
11
11
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
12
12
|
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
13
13
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
@@ -59,10 +59,12 @@ export var useColumnWidths = function useColumnWidths(_ref) {
|
|
|
59
59
|
onColumnResize = _ref.onColumnResize;
|
|
60
60
|
var computeColumnWidths = useCallback(function () {
|
|
61
61
|
return columns.filter(doesColumnHaveAnInitialWidth).reduce(function (initialWidths, column) {
|
|
62
|
-
initialWidths
|
|
63
|
-
return initialWidths;
|
|
62
|
+
return _objectSpread(_objectSpread({}, initialWidths), {}, _defineProperty({}, column.id, column.initialWidth));
|
|
64
63
|
}, {});
|
|
65
64
|
}, [columns]);
|
|
65
|
+
|
|
66
|
+
// Passes initializer function for performance, so computing only runs once on init
|
|
67
|
+
// @see https://react.dev/reference/react/useState#examples-initializer
|
|
66
68
|
var _useState = useState(computeColumnWidths),
|
|
67
69
|
_useState2 = _slicedToArray(_useState, 2),
|
|
68
70
|
columnWidths = _useState2[0],
|
|
@@ -71,14 +73,16 @@ export var useColumnWidths = function useColumnWidths(_ref) {
|
|
|
71
73
|
setColumnWidths(computeColumnWidths());
|
|
72
74
|
}, [computeColumnWidths]);
|
|
73
75
|
var setColumnWidth = useCallback(function (columnId, width) {
|
|
74
|
-
setColumnWidths(
|
|
76
|
+
setColumnWidths(function (prevColumnWidths) {
|
|
77
|
+
return _objectSpread(_objectSpread({}, prevColumnWidths), {}, _defineProperty({}, columnId, width));
|
|
78
|
+
});
|
|
75
79
|
if (onColumnResize) {
|
|
76
80
|
onColumnResize({
|
|
77
81
|
columnId: columnId,
|
|
78
82
|
width: width
|
|
79
83
|
});
|
|
80
84
|
}
|
|
81
|
-
}, [
|
|
85
|
+
}, [onColumnResize]);
|
|
82
86
|
|
|
83
87
|
// Used by react-window to determine actual column widths
|
|
84
88
|
var getColumnWidth = useCallback(function (index) {
|
|
@@ -92,14 +92,16 @@ export var useFocus = function useFocus() {
|
|
|
92
92
|
}
|
|
93
93
|
};
|
|
94
94
|
}, [isFocusedCellInView, focusFirstVisibleInteractiveCell]);
|
|
95
|
-
return {
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
95
|
+
return useMemo(function () {
|
|
96
|
+
return {
|
|
97
|
+
onFocusUpdate: onFocusUpdate,
|
|
98
|
+
focusedCell: focusedCell,
|
|
99
|
+
setFocusedCell: setFocusedCell,
|
|
100
|
+
setIsFocusedCellInView: setIsFocusedCellInView,
|
|
101
|
+
focusFirstVisibleInteractiveCell: focusFirstVisibleInteractiveCell,
|
|
102
|
+
focusProps: focusProps
|
|
103
|
+
};
|
|
104
|
+
}, [onFocusUpdate, focusedCell, setFocusedCell, setIsFocusedCellInView, focusFirstVisibleInteractiveCell, focusProps]);
|
|
103
105
|
};
|
|
104
106
|
export var notifyCellOfFocusState = function notifyCellOfFocusState(cellsUpdateFocus, cell, isFocused) {
|
|
105
107
|
var key = "".concat(cell[0], "-").concat(cell[1]);
|