@elastic/eui 97.0.0 → 97.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/components/datagrid/body/cell/data_grid_cell.styles.js +4 -2
- package/es/components/datagrid/body/cell/focus_utils.js +14 -4
- package/es/components/datagrid/body/data_grid_body.js +2 -1
- package/es/components/datagrid/body/data_grid_body_custom.js +5 -2
- package/es/components/datagrid/body/data_grid_body_virtualized.js +8 -4
- package/es/components/datagrid/body/header/column_actions.js +262 -27
- package/es/components/datagrid/body/header/{data_grid_column_resizer.js → column_resizer.js} +10 -4
- package/es/components/datagrid/body/header/{data_grid_column_resizer.styles.js → column_resizer.styles.js} +6 -1
- package/es/components/datagrid/body/header/column_sorting.js +134 -0
- package/es/components/datagrid/body/header/data_grid_control_header_cell.js +3 -3
- package/es/components/datagrid/body/header/data_grid_header_cell.js +86 -305
- package/es/components/datagrid/body/header/data_grid_header_cell.styles.js +1 -1
- package/es/components/datagrid/body/header/data_grid_header_cell_wrapper.js +19 -17
- package/es/components/datagrid/body/header/data_grid_header_cell_wrapper.styles.js +1 -2
- package/es/components/datagrid/body/header/data_grid_header_row.js +25 -10
- package/es/components/datagrid/body/header/draggable_columns.js +301 -0
- package/es/components/datagrid/body/header/draggable_columns.styles.js +38 -0
- package/es/components/datagrid/data_grid.js +2 -1
- package/es/components/datagrid/data_grid.stories.utils.js +9 -6
- package/es/components/datagrid/utils/col_widths.js +4 -6
- package/es/components/datagrid/utils/focus.js +2 -2
- package/es/components/datagrid/utils/scrolling.js +13 -10
- package/es/components/date_picker/super_date_picker/date_popover/absolute_tab.js +8 -2
- package/es/components/date_picker/super_date_picker/date_popover/date_popover_button.js +8 -2
- package/es/components/date_picker/super_date_picker/date_popover/date_popover_content.js +8 -2
- package/es/components/date_picker/super_date_picker/super_date_picker.js +27 -5
- package/es/components/drag_and_drop/draggable.js +13 -5
- package/es/components/header/header.styles.js +6 -12
- package/es/components/header/header_links/header_links.js +1 -1
- package/es/components/header/header_links/header_links.styles.js +1 -0
- package/es/components/page_template/inner/page_inner.styles.js +3 -4
- package/es/components/tabs/tab.js +1 -1
- package/eui.d.ts +417 -307
- package/i18ntokens.json +175 -175
- package/lib/components/datagrid/body/cell/data_grid_cell.styles.js +4 -2
- package/lib/components/datagrid/body/cell/focus_utils.js +14 -4
- package/lib/components/datagrid/body/data_grid_body.js +2 -1
- package/lib/components/datagrid/body/data_grid_body_custom.js +5 -2
- package/lib/components/datagrid/body/data_grid_body_virtualized.js +8 -4
- package/lib/components/datagrid/body/header/column_actions.js +265 -29
- package/lib/components/datagrid/body/header/{data_grid_column_resizer.js → column_resizer.js} +11 -5
- package/{optimize/lib/components/datagrid/body/header/data_grid_column_resizer.styles.js → lib/components/datagrid/body/header/column_resizer.styles.js} +6 -1
- package/lib/components/datagrid/body/header/column_sorting.js +144 -0
- package/lib/components/datagrid/body/header/data_grid_control_header_cell.js +3 -3
- package/lib/components/datagrid/body/header/data_grid_header_cell.js +86 -305
- package/lib/components/datagrid/body/header/data_grid_header_cell.styles.js +1 -1
- package/lib/components/datagrid/body/header/data_grid_header_cell_wrapper.js +19 -17
- package/lib/components/datagrid/body/header/data_grid_header_cell_wrapper.styles.js +1 -2
- package/lib/components/datagrid/body/header/data_grid_header_row.js +24 -9
- package/lib/components/datagrid/body/header/draggable_columns.js +308 -0
- package/lib/components/datagrid/body/header/draggable_columns.styles.js +42 -0
- package/lib/components/datagrid/data_grid.js +2 -1
- package/lib/components/datagrid/data_grid.stories.utils.js +9 -6
- package/lib/components/datagrid/utils/col_widths.js +4 -6
- package/lib/components/datagrid/utils/focus.js +2 -2
- package/lib/components/datagrid/utils/scrolling.js +13 -10
- package/lib/components/date_picker/super_date_picker/date_popover/absolute_tab.js +8 -2
- package/lib/components/date_picker/super_date_picker/date_popover/date_popover_button.js +8 -2
- package/lib/components/date_picker/super_date_picker/date_popover/date_popover_content.js +8 -2
- package/lib/components/date_picker/super_date_picker/super_date_picker.js +27 -5
- package/lib/components/drag_and_drop/draggable.js +13 -5
- package/lib/components/header/header.styles.js +6 -12
- package/lib/components/header/header_links/header_links.js +1 -1
- package/lib/components/header/header_links/header_links.styles.js +1 -0
- package/lib/components/page_template/inner/page_inner.styles.js +3 -4
- package/lib/components/tabs/tab.js +1 -1
- package/optimize/es/components/datagrid/body/cell/data_grid_cell.styles.js +4 -2
- package/optimize/es/components/datagrid/body/cell/focus_utils.js +13 -4
- package/optimize/es/components/datagrid/body/data_grid_body_custom.js +3 -1
- package/optimize/es/components/datagrid/body/data_grid_body_virtualized.js +6 -3
- package/optimize/es/components/datagrid/body/header/column_actions.js +250 -26
- package/optimize/es/components/datagrid/body/header/{data_grid_column_resizer.js → column_resizer.js} +8 -3
- package/optimize/es/components/datagrid/body/header/{data_grid_column_resizer.styles.js → column_resizer.styles.js} +6 -1
- package/optimize/es/components/datagrid/body/header/column_sorting.js +134 -0
- package/optimize/es/components/datagrid/body/header/data_grid_control_header_cell.js +2 -2
- package/optimize/es/components/datagrid/body/header/data_grid_header_cell.js +82 -302
- package/optimize/es/components/datagrid/body/header/data_grid_header_cell.styles.js +1 -1
- package/optimize/es/components/datagrid/body/header/data_grid_header_cell_wrapper.js +15 -14
- package/optimize/es/components/datagrid/body/header/data_grid_header_cell_wrapper.styles.js +1 -2
- package/optimize/es/components/datagrid/body/header/data_grid_header_row.js +25 -10
- package/optimize/es/components/datagrid/body/header/draggable_columns.js +223 -0
- package/optimize/es/components/datagrid/body/header/draggable_columns.styles.js +38 -0
- package/optimize/es/components/datagrid/data_grid.js +2 -1
- package/optimize/es/components/datagrid/data_grid.stories.utils.js +7 -5
- package/optimize/es/components/datagrid/utils/col_widths.js +4 -6
- package/optimize/es/components/datagrid/utils/focus.js +2 -2
- package/optimize/es/components/datagrid/utils/scrolling.js +13 -10
- package/optimize/es/components/date_picker/super_date_picker/date_popover/absolute_tab.js +5 -1
- package/optimize/es/components/date_picker/super_date_picker/date_popover/date_popover_button.js +6 -2
- package/optimize/es/components/date_picker/super_date_picker/date_popover/date_popover_content.js +6 -2
- package/optimize/es/components/date_picker/super_date_picker/super_date_picker.js +11 -5
- package/optimize/es/components/drag_and_drop/draggable.js +8 -3
- package/optimize/es/components/header/header.styles.js +6 -12
- package/optimize/es/components/header/header_links/header_links.js +1 -1
- package/optimize/es/components/header/header_links/header_links.styles.js +1 -0
- package/optimize/es/components/page_template/inner/page_inner.styles.js +3 -4
- package/optimize/es/components/tabs/tab.js +1 -1
- package/optimize/lib/components/datagrid/body/cell/data_grid_cell.styles.js +4 -2
- package/optimize/lib/components/datagrid/body/cell/focus_utils.js +13 -4
- package/optimize/lib/components/datagrid/body/data_grid_body_custom.js +3 -1
- package/optimize/lib/components/datagrid/body/data_grid_body_virtualized.js +6 -3
- package/optimize/lib/components/datagrid/body/header/column_actions.js +253 -27
- package/optimize/lib/components/datagrid/body/header/{data_grid_column_resizer.js → column_resizer.js} +9 -4
- package/{test-env/components/datagrid/body/header/data_grid_column_resizer.styles.js → optimize/lib/components/datagrid/body/header/column_resizer.styles.js} +6 -1
- package/optimize/lib/components/datagrid/body/header/column_sorting.js +144 -0
- package/optimize/lib/components/datagrid/body/header/data_grid_control_header_cell.js +2 -2
- package/optimize/lib/components/datagrid/body/header/data_grid_header_cell.js +80 -300
- package/optimize/lib/components/datagrid/body/header/data_grid_header_cell.styles.js +1 -1
- package/optimize/lib/components/datagrid/body/header/data_grid_header_cell_wrapper.js +15 -14
- package/optimize/lib/components/datagrid/body/header/data_grid_header_cell_wrapper.styles.js +1 -2
- package/optimize/lib/components/datagrid/body/header/data_grid_header_row.js +24 -9
- package/optimize/lib/components/datagrid/body/header/draggable_columns.js +231 -0
- package/optimize/lib/components/datagrid/body/header/draggable_columns.styles.js +43 -0
- package/optimize/lib/components/datagrid/data_grid.js +2 -1
- package/optimize/lib/components/datagrid/data_grid.stories.utils.js +7 -5
- package/optimize/lib/components/datagrid/utils/col_widths.js +4 -6
- package/optimize/lib/components/datagrid/utils/focus.js +2 -2
- package/optimize/lib/components/datagrid/utils/scrolling.js +13 -10
- package/optimize/lib/components/date_picker/super_date_picker/date_popover/absolute_tab.js +5 -1
- package/optimize/lib/components/date_picker/super_date_picker/date_popover/date_popover_button.js +6 -2
- package/optimize/lib/components/date_picker/super_date_picker/date_popover/date_popover_content.js +6 -2
- package/optimize/lib/components/date_picker/super_date_picker/super_date_picker.js +11 -5
- package/optimize/lib/components/drag_and_drop/draggable.js +8 -3
- package/optimize/lib/components/header/header.styles.js +6 -12
- package/optimize/lib/components/header/header_links/header_links.js +1 -1
- package/optimize/lib/components/header/header_links/header_links.styles.js +1 -0
- package/optimize/lib/components/page_template/inner/page_inner.styles.js +3 -4
- package/optimize/lib/components/tabs/tab.js +1 -1
- package/package.json +1 -1
- package/test-env/components/datagrid/body/cell/data_grid_cell.styles.js +4 -2
- package/test-env/components/datagrid/body/cell/focus_utils.js +13 -4
- package/test-env/components/datagrid/body/data_grid_body.js +2 -1
- package/test-env/components/datagrid/body/data_grid_body_custom.js +5 -2
- package/test-env/components/datagrid/body/data_grid_body_virtualized.js +8 -4
- package/test-env/components/datagrid/body/header/column_actions.js +261 -27
- package/test-env/components/datagrid/body/header/{data_grid_column_resizer.js → column_resizer.js} +11 -5
- package/{lib/components/datagrid/body/header/data_grid_column_resizer.styles.js → test-env/components/datagrid/body/header/column_resizer.styles.js} +6 -1
- package/test-env/components/datagrid/body/header/column_sorting.js +144 -0
- package/test-env/components/datagrid/body/header/data_grid_control_header_cell.js +3 -3
- package/test-env/components/datagrid/body/header/data_grid_header_cell.js +82 -301
- package/test-env/components/datagrid/body/header/data_grid_header_cell.styles.js +1 -1
- package/test-env/components/datagrid/body/header/data_grid_header_cell_wrapper.js +19 -17
- package/test-env/components/datagrid/body/header/data_grid_header_cell_wrapper.styles.js +1 -2
- package/test-env/components/datagrid/body/header/data_grid_header_row.js +24 -9
- package/test-env/components/datagrid/body/header/draggable_columns.js +305 -0
- package/test-env/components/datagrid/body/header/draggable_columns.styles.js +43 -0
- package/test-env/components/datagrid/data_grid.js +2 -1
- package/test-env/components/datagrid/data_grid.stories.utils.js +9 -6
- package/test-env/components/datagrid/utils/col_widths.js +4 -6
- package/test-env/components/datagrid/utils/focus.js +2 -2
- package/test-env/components/datagrid/utils/scrolling.js +13 -10
- package/test-env/components/date_picker/super_date_picker/date_popover/absolute_tab.js +8 -2
- package/test-env/components/date_picker/super_date_picker/date_popover/date_popover_button.js +8 -2
- package/test-env/components/date_picker/super_date_picker/date_popover/date_popover_content.js +8 -2
- package/test-env/components/date_picker/super_date_picker/super_date_picker.js +27 -5
- package/test-env/components/drag_and_drop/draggable.js +13 -5
- package/test-env/components/header/header.styles.js +6 -12
- package/test-env/components/header/header_links/header_links.js +1 -1
- package/test-env/components/header/header_links/header_links.styles.js +1 -0
- package/test-env/components/page_template/inner/page_inner.styles.js +3 -4
- package/test-env/components/tabs/tab.js +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
2
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
4
4
|
/*
|
|
5
5
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
6
6
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
@@ -10,17 +10,13 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
12
|
import classnames from 'classnames';
|
|
13
|
-
import React, {
|
|
14
|
-
import {
|
|
15
|
-
import { keys, useGeneratedHtmlId, useEuiMemoizedStyles } from '../../../../services';
|
|
16
|
-
import { EuiI18n, useEuiI18n } from '../../../i18n';
|
|
13
|
+
import React, { memo, useMemo, useRef, useState } from 'react';
|
|
14
|
+
import { useEuiMemoizedStyles } from '../../../../services';
|
|
17
15
|
import { EuiIcon } from '../../../icon';
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import { getColumnActions } from './column_actions';
|
|
23
|
-
import { EuiDataGridColumnResizer } from './data_grid_column_resizer';
|
|
16
|
+
import { useHasColumnActions, ColumnActions } from './column_actions';
|
|
17
|
+
import { useColumnSorting } from './column_sorting';
|
|
18
|
+
import { ConditionalDraggableColumn } from './draggable_columns';
|
|
19
|
+
import { EuiDataGridColumnResizer } from './column_resizer';
|
|
24
20
|
import { EuiDataGridHeaderCellWrapper } from './data_grid_header_cell_wrapper';
|
|
25
21
|
import { euiDataGridHeaderCellStyles } from './data_grid_header_cell.styles';
|
|
26
22
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
@@ -31,315 +27,99 @@ export var EuiDataGridHeaderCell = /*#__PURE__*/memo(function (_ref) {
|
|
|
31
27
|
columnWidths = _ref.columnWidths,
|
|
32
28
|
defaultColumnWidth = _ref.defaultColumnWidth,
|
|
33
29
|
setColumnWidth = _ref.setColumnWidth,
|
|
34
|
-
visibleColCount = _ref.visibleColCount,
|
|
35
30
|
setVisibleColumns = _ref.setVisibleColumns,
|
|
36
31
|
switchColumnPos = _ref.switchColumnPos,
|
|
32
|
+
isLastColumn = _ref.isLastColumn,
|
|
37
33
|
sorting = _ref.sorting,
|
|
38
34
|
schema = _ref.schema,
|
|
39
|
-
schemaDetectors = _ref.schemaDetectors
|
|
35
|
+
schemaDetectors = _ref.schemaDetectors,
|
|
36
|
+
canDragAndDropColumns = _ref.canDragAndDropColumns,
|
|
37
|
+
gridStyles = _ref.gridStyles;
|
|
40
38
|
var id = column.id,
|
|
41
39
|
display = column.display,
|
|
42
40
|
displayAsText = column.displayAsText,
|
|
43
|
-
displayHeaderCellProps = column.displayHeaderCellProps
|
|
41
|
+
displayHeaderCellProps = column.displayHeaderCellProps,
|
|
42
|
+
actions = column.actions;
|
|
44
43
|
var title = displayAsText || id;
|
|
45
44
|
var children = display || displayAsText || id;
|
|
46
45
|
var width = columnWidths[id] || defaultColumnWidth;
|
|
47
46
|
var columnType = schema[id] ? schema[id].columnType : null;
|
|
48
|
-
var
|
|
49
|
-
|
|
50
|
-
|
|
47
|
+
var hasColumnActions = useHasColumnActions(actions);
|
|
48
|
+
var classes = classnames(_defineProperty(_defineProperty({}, "euiDataGridHeaderCell--".concat(columnType), columnType), 'euiDataGridHeaderCell--hasColumnActions', hasColumnActions), displayHeaderCellProps === null || displayHeaderCellProps === void 0 ? void 0 : displayHeaderCellProps.className);
|
|
49
|
+
var styles = useEuiMemoizedStyles(euiDataGridHeaderCellStyles);
|
|
50
|
+
var contentStyles = [styles.euiDataGridHeaderCell__content, (columnType === 'numeric' || columnType === 'currency') && styles.right];
|
|
51
51
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
*/
|
|
55
|
-
var _useState = useState(false),
|
|
52
|
+
// Props passed from <ColumnActions /> to be set on <EuiDataGridHeaderCellWrapper />
|
|
53
|
+
var _useState = useState({}),
|
|
56
54
|
_useState2 = _slicedToArray(_useState, 2),
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
var togglePopover = useCallback(function () {
|
|
60
|
-
setIsPopoverOpen(function (isOpen) {
|
|
61
|
-
return !isOpen;
|
|
62
|
-
});
|
|
63
|
-
}, []);
|
|
64
|
-
var closePopover = useCallback(function () {
|
|
65
|
-
return setIsPopoverOpen(false);
|
|
66
|
-
}, []);
|
|
67
|
-
var popoverArrowNavigationProps = usePopoverArrowNavigation();
|
|
68
|
-
var columnActions = useMemo(function () {
|
|
69
|
-
return getColumnActions({
|
|
70
|
-
column: column,
|
|
71
|
-
columns: columns,
|
|
72
|
-
schema: schema,
|
|
73
|
-
schemaDetectors: schemaDetectors,
|
|
74
|
-
setVisibleColumns: setVisibleColumns,
|
|
75
|
-
focusFirstVisibleInteractiveCell: focusFirstVisibleInteractiveCell,
|
|
76
|
-
setIsPopoverOpen: setIsPopoverOpen,
|
|
77
|
-
sorting: sorting,
|
|
78
|
-
switchColumnPos: switchColumnPos,
|
|
79
|
-
setFocusedCell: setFocusedCell,
|
|
80
|
-
columnFocusIndex: index
|
|
81
|
-
});
|
|
82
|
-
}, [column, columns, schema, schemaDetectors, setVisibleColumns, focusFirstVisibleInteractiveCell, setIsPopoverOpen, sorting, switchColumnPos, setFocusedCell, index]);
|
|
83
|
-
var showColumnActions = columnActions && columnActions.length > 0;
|
|
55
|
+
propsFromColumnActions = _useState2[0],
|
|
56
|
+
setPropsFromColumnActions = _useState2[1];
|
|
84
57
|
var actionsButtonRef = useRef(null);
|
|
85
|
-
var
|
|
86
|
-
var _actionsButtonRef$cur;
|
|
87
|
-
(_actionsButtonRef$cur = actionsButtonRef.current) === null || _actionsButtonRef$cur === void 0 || _actionsButtonRef$cur.click();
|
|
88
|
-
}, []);
|
|
89
|
-
var _useState3 = useState(false),
|
|
90
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
91
|
-
isActionsButtonFocused = _useState4[0],
|
|
92
|
-
setIsActionsButtonFocused = _useState4[1];
|
|
93
|
-
var actionsButtonAriaLabel = useEuiI18n('euiDataGridHeaderCell.actionsButtonAriaLabel', '{title}. Click to view column header actions.', {
|
|
94
|
-
title: title
|
|
95
|
-
});
|
|
96
|
-
var actionsEnterKeyInstructions = useEuiI18n('euiDataGridHeaderCell.actionsEnterKeyInstructions', "Press the Enter key to view this column's actions");
|
|
97
|
-
|
|
98
|
-
/*
|
|
99
|
-
* Column sorting
|
|
100
|
-
*/
|
|
101
|
-
var _useSortingUtils = useSortingUtils({
|
|
58
|
+
var _useColumnSorting = useColumnSorting({
|
|
102
59
|
sorting: sorting,
|
|
103
60
|
id: id,
|
|
104
|
-
|
|
61
|
+
hasColumnActions: hasColumnActions
|
|
105
62
|
}),
|
|
106
|
-
sortingArrow =
|
|
107
|
-
ariaSort =
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
});
|
|
113
|
-
|
|
114
|
-
/*
|
|
115
|
-
* Rendering
|
|
116
|
-
*/
|
|
117
|
-
var classes = classnames(_defineProperty(_defineProperty(_defineProperty({}, "euiDataGridHeaderCell--".concat(columnType), columnType), 'euiDataGridHeaderCell--hasColumnActions', showColumnActions), 'euiDataGridHeaderCell--isActionsPopoverOpen', isPopoverOpen), displayHeaderCellProps === null || displayHeaderCellProps === void 0 ? void 0 : displayHeaderCellProps.className);
|
|
118
|
-
var styles = useEuiMemoizedStyles(euiDataGridHeaderCellStyles);
|
|
119
|
-
var contentStyles = [styles.euiDataGridHeaderCell__content, (columnType === 'numeric' || columnType === 'currency') && styles.right];
|
|
120
|
-
return ___EmotionJSX(EuiDataGridHeaderCellWrapper, _extends({}, displayHeaderCellProps, {
|
|
121
|
-
className: classes,
|
|
122
|
-
id: id,
|
|
123
|
-
index: index,
|
|
124
|
-
visibleColCount: visibleColCount,
|
|
125
|
-
width: width,
|
|
126
|
-
"aria-sort": ariaSort,
|
|
127
|
-
hasActionsPopover: showColumnActions,
|
|
128
|
-
openActionsPopover: clickActionsButton,
|
|
129
|
-
"aria-label": displayAsText && "".concat(displayAsText, ", ") // ensure cell text content is read first, if available
|
|
130
|
-
,
|
|
131
|
-
"aria-describedby": sortingAriaId
|
|
132
|
-
}), function (hasFocusTrap) {
|
|
133
|
-
return ___EmotionJSX(React.Fragment, null, column.isResizable !== false && width != null ? ___EmotionJSX(EuiDataGridColumnResizer, {
|
|
63
|
+
sortingArrow = _useColumnSorting.sortingArrow,
|
|
64
|
+
ariaSort = _useColumnSorting.ariaSort,
|
|
65
|
+
sortingAriaId = _useColumnSorting.sortingAriaId,
|
|
66
|
+
sortingScreenReaderText = _useColumnSorting.sortingScreenReaderText;
|
|
67
|
+
var columnResizer = useMemo(function () {
|
|
68
|
+
return column.isResizable !== false && width != null ? ___EmotionJSX(EuiDataGridColumnResizer, {
|
|
134
69
|
columnId: id,
|
|
135
70
|
columnWidth: width,
|
|
136
|
-
setColumnWidth: setColumnWidth
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
,
|
|
166
|
-
"
|
|
167
|
-
:
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
71
|
+
setColumnWidth: setColumnWidth,
|
|
72
|
+
isLastColumn: isLastColumn
|
|
73
|
+
}) : null;
|
|
74
|
+
}, [column.isResizable, id, width, setColumnWidth, isLastColumn]);
|
|
75
|
+
return ___EmotionJSX(ConditionalDraggableColumn, {
|
|
76
|
+
id: id,
|
|
77
|
+
index: index,
|
|
78
|
+
canDragAndDropColumns: !!canDragAndDropColumns,
|
|
79
|
+
gridStyles: gridStyles,
|
|
80
|
+
columnResizer: columnResizer,
|
|
81
|
+
actionsPopoverToggle: actionsButtonRef.current
|
|
82
|
+
}, function (dragProps) {
|
|
83
|
+
return ___EmotionJSX(EuiDataGridHeaderCellWrapper, _extends({}, displayHeaderCellProps, dragProps, {
|
|
84
|
+
hasColumnActions: hasColumnActions
|
|
85
|
+
}, propsFromColumnActions, {
|
|
86
|
+
className: classnames(classes, propsFromColumnActions.className),
|
|
87
|
+
id: id,
|
|
88
|
+
index: index,
|
|
89
|
+
isLastColumn: isLastColumn,
|
|
90
|
+
width: width,
|
|
91
|
+
"aria-sort": ariaSort,
|
|
92
|
+
"aria-label": displayAsText && "".concat(displayAsText, ", ") // ensure cell text content is read first, if available
|
|
93
|
+
,
|
|
94
|
+
"aria-describedby": classnames(sortingAriaId, dragProps === null || dragProps === void 0 ? void 0 : dragProps['aria-describedby']),
|
|
95
|
+
"data-column-moving": propsFromColumnActions['data-column-moving'] || (dragProps === null || dragProps === void 0 ? void 0 : dragProps['data-column-moving']) || undefined
|
|
96
|
+
}), function (hasFocusTrap) {
|
|
97
|
+
return ___EmotionJSX(React.Fragment, null, !canDragAndDropColumns && columnResizer, canDragAndDropColumns && ___EmotionJSX("span", {
|
|
98
|
+
className: "euiDataGridHeaderCell__draggableIcon"
|
|
99
|
+
}, ___EmotionJSX(EuiIcon, {
|
|
100
|
+
type: "grabOmnidirectional",
|
|
101
|
+
size: "s",
|
|
102
|
+
css: styles.euiDataGridHeaderCell__actions
|
|
103
|
+
})), ___EmotionJSX("div", {
|
|
104
|
+
css: contentStyles,
|
|
105
|
+
className: "euiDataGridHeaderCell__content",
|
|
106
|
+
title: title
|
|
107
|
+
}, children), sortingArrow, sortingScreenReaderText, hasColumnActions && ___EmotionJSX(ColumnActions, {
|
|
108
|
+
index: index,
|
|
109
|
+
id: id,
|
|
110
|
+
title: title,
|
|
111
|
+
column: column,
|
|
112
|
+
columns: columns,
|
|
113
|
+
schema: schema,
|
|
114
|
+
schemaDetectors: schemaDetectors,
|
|
115
|
+
setVisibleColumns: setVisibleColumns,
|
|
116
|
+
switchColumnPos: switchColumnPos,
|
|
117
|
+
sorting: sorting,
|
|
118
|
+
hasFocusTrap: hasFocusTrap,
|
|
119
|
+
setPropsFromColumnActions: setPropsFromColumnActions,
|
|
120
|
+
actionsButtonRef: actionsButtonRef
|
|
121
|
+
}));
|
|
122
|
+
});
|
|
178
123
|
});
|
|
179
124
|
});
|
|
180
|
-
EuiDataGridHeaderCell.displayName = 'EuiDataGridHeaderCell';
|
|
181
|
-
|
|
182
|
-
/**
|
|
183
|
-
* Column sorting utility helpers
|
|
184
|
-
*/
|
|
185
|
-
export var useSortingUtils = function useSortingUtils(_ref2) {
|
|
186
|
-
var _sorting$columns;
|
|
187
|
-
var sorting = _ref2.sorting,
|
|
188
|
-
id = _ref2.id,
|
|
189
|
-
showColumnActions = _ref2.showColumnActions;
|
|
190
|
-
var sortedColumn = useMemo(function () {
|
|
191
|
-
return sorting === null || sorting === void 0 ? void 0 : sorting.columns.find(function (col) {
|
|
192
|
-
return col.id === id;
|
|
193
|
-
});
|
|
194
|
-
}, [sorting, id]);
|
|
195
|
-
var isColumnSorted = !!sortedColumn;
|
|
196
|
-
var hasOnlyOneSort = (sorting === null || sorting === void 0 || (_sorting$columns = sorting.columns) === null || _sorting$columns === void 0 ? void 0 : _sorting$columns.length) === 1;
|
|
197
|
-
|
|
198
|
-
/**
|
|
199
|
-
* Arrow icon
|
|
200
|
-
*/
|
|
201
|
-
var sortingArrow = useMemo(function () {
|
|
202
|
-
return isColumnSorted ? ___EmotionJSX(EuiIcon, {
|
|
203
|
-
type: sortedColumn.direction === 'asc' ? 'sortUp' : 'sortDown',
|
|
204
|
-
color: "text",
|
|
205
|
-
className: "euiDataGridHeaderCell__sortingArrow",
|
|
206
|
-
"data-test-subj": "dataGridHeaderCellSortingIcon-".concat(id)
|
|
207
|
-
}) : null;
|
|
208
|
-
}, [id, isColumnSorted, sortedColumn]);
|
|
209
|
-
|
|
210
|
-
/**
|
|
211
|
-
* aria-sort attribute - should only be used when a single column is being sorted
|
|
212
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-sort
|
|
213
|
-
* @see https://www.w3.org/WAI/ARIA/apg/example-index/table/sortable-table.html
|
|
214
|
-
* @see https://github.com/w3c/aria/issues/283 for potential future multi-column usage
|
|
215
|
-
*/
|
|
216
|
-
var ariaSort = isColumnSorted && hasOnlyOneSort ? sorting.columns[0].direction === 'asc' ? 'ascending' : 'descending' : undefined;
|
|
217
|
-
|
|
218
|
-
/**
|
|
219
|
-
* Sorting status - screen reader text
|
|
220
|
-
*/
|
|
221
|
-
var sortingScreenReaderText = useMemo(function () {
|
|
222
|
-
var _sorting$columns2;
|
|
223
|
-
if (!isColumnSorted) return null;
|
|
224
|
-
if (!showColumnActions && hasOnlyOneSort) return null; // in this scenario, the `aria-sort` attribute will be used by screen readers
|
|
225
|
-
return ___EmotionJSX(React.Fragment, null, sorting === null || sorting === void 0 || (_sorting$columns2 = sorting.columns) === null || _sorting$columns2 === void 0 ? void 0 : _sorting$columns2.map(function (_ref3, index) {
|
|
226
|
-
var columnId = _ref3.id,
|
|
227
|
-
direction = _ref3.direction;
|
|
228
|
-
if (hasOnlyOneSort) {
|
|
229
|
-
if (direction === 'asc') {
|
|
230
|
-
return ___EmotionJSX(EuiI18n, {
|
|
231
|
-
token: "euiDataGridHeaderCell.sortedByAscendingSingle",
|
|
232
|
-
default: "Sorted ascending",
|
|
233
|
-
key: index
|
|
234
|
-
});
|
|
235
|
-
} else {
|
|
236
|
-
return ___EmotionJSX(EuiI18n, {
|
|
237
|
-
token: "euiDataGridHeaderCell.sortedByDescendingSingle",
|
|
238
|
-
default: "Sorted descending",
|
|
239
|
-
key: index
|
|
240
|
-
});
|
|
241
|
-
}
|
|
242
|
-
} else if (index === 0) {
|
|
243
|
-
if (direction === 'asc') {
|
|
244
|
-
return ___EmotionJSX(EuiI18n, {
|
|
245
|
-
token: "euiDataGridHeaderCell.sortedByAscendingFirst",
|
|
246
|
-
default: "Sorted by {columnId}, ascending",
|
|
247
|
-
values: {
|
|
248
|
-
columnId: columnId
|
|
249
|
-
},
|
|
250
|
-
key: index
|
|
251
|
-
});
|
|
252
|
-
} else {
|
|
253
|
-
return ___EmotionJSX(EuiI18n, {
|
|
254
|
-
token: "euiDataGridHeaderCell.sortedByDescendingFirst",
|
|
255
|
-
default: "Sorted by {columnId}, descending",
|
|
256
|
-
values: {
|
|
257
|
-
columnId: columnId
|
|
258
|
-
},
|
|
259
|
-
key: index
|
|
260
|
-
});
|
|
261
|
-
}
|
|
262
|
-
} else {
|
|
263
|
-
if (direction === 'asc') {
|
|
264
|
-
return ___EmotionJSX(EuiI18n, {
|
|
265
|
-
token: "euiDataGridHeaderCell.sortedByAscendingMultiple",
|
|
266
|
-
default: ", then sorted by {columnId}, ascending",
|
|
267
|
-
values: {
|
|
268
|
-
columnId: columnId
|
|
269
|
-
},
|
|
270
|
-
key: index
|
|
271
|
-
});
|
|
272
|
-
} else {
|
|
273
|
-
return ___EmotionJSX(EuiI18n, {
|
|
274
|
-
token: "euiDataGridHeaderCell.sortedByDescendingMultiple",
|
|
275
|
-
default: ", then sorted by {columnId}, descending",
|
|
276
|
-
values: {
|
|
277
|
-
columnId: columnId
|
|
278
|
-
},
|
|
279
|
-
key: index
|
|
280
|
-
});
|
|
281
|
-
}
|
|
282
|
-
}
|
|
283
|
-
}), ".");
|
|
284
|
-
}, [isColumnSorted, showColumnActions, hasOnlyOneSort, sorting]);
|
|
285
|
-
return {
|
|
286
|
-
sortingArrow: sortingArrow,
|
|
287
|
-
ariaSort: ariaSort,
|
|
288
|
-
sortingScreenReaderText: sortingScreenReaderText
|
|
289
|
-
};
|
|
290
|
-
};
|
|
291
|
-
|
|
292
|
-
/**
|
|
293
|
-
* Add keyboard arrow navigation to the cell actions popover
|
|
294
|
-
* to match the UX of the rest of EuiDataGrid
|
|
295
|
-
*/
|
|
296
|
-
export var usePopoverArrowNavigation = function usePopoverArrowNavigation() {
|
|
297
|
-
var popoverPanelRef = useRef(null);
|
|
298
|
-
var actionsRef = useRef(undefined);
|
|
299
|
-
var panelRef = useCallback(function (ref) {
|
|
300
|
-
popoverPanelRef.current = ref;
|
|
301
|
-
actionsRef.current = ref ? tabbable(ref) : undefined;
|
|
302
|
-
}, []);
|
|
303
|
-
var onKeyDown = useCallback(function (e) {
|
|
304
|
-
var _actionsRef$current;
|
|
305
|
-
if (e.key !== keys.ARROW_DOWN && e.key !== keys.ARROW_UP) return;
|
|
306
|
-
if (!((_actionsRef$current = actionsRef.current) !== null && _actionsRef$current !== void 0 && _actionsRef$current.length)) return;
|
|
307
|
-
e.preventDefault();
|
|
308
|
-
var initialState = document.activeElement === popoverPanelRef.current;
|
|
309
|
-
var currentIndex = !initialState ? actionsRef.current.findIndex(function (el) {
|
|
310
|
-
return document.activeElement === el;
|
|
311
|
-
}) : -1;
|
|
312
|
-
var lastIndex = actionsRef.current.length - 1;
|
|
313
|
-
var indexToFocus;
|
|
314
|
-
if (initialState) {
|
|
315
|
-
if (e.key === keys.ARROW_DOWN) {
|
|
316
|
-
indexToFocus = 0;
|
|
317
|
-
} else if (e.key === keys.ARROW_UP) {
|
|
318
|
-
indexToFocus = lastIndex;
|
|
319
|
-
}
|
|
320
|
-
} else {
|
|
321
|
-
if (e.key === keys.ARROW_DOWN) {
|
|
322
|
-
indexToFocus = currentIndex + 1;
|
|
323
|
-
if (indexToFocus > lastIndex) {
|
|
324
|
-
indexToFocus = 0;
|
|
325
|
-
}
|
|
326
|
-
} else if (e.key === keys.ARROW_UP) {
|
|
327
|
-
indexToFocus = currentIndex - 1;
|
|
328
|
-
if (indexToFocus < 0) {
|
|
329
|
-
indexToFocus = lastIndex;
|
|
330
|
-
}
|
|
331
|
-
}
|
|
332
|
-
}
|
|
333
|
-
actionsRef.current[indexToFocus].focus();
|
|
334
|
-
}, []);
|
|
335
|
-
return {
|
|
336
|
-
panelRef: panelRef,
|
|
337
|
-
panelProps: {
|
|
338
|
-
onKeyDown: onKeyDown
|
|
339
|
-
},
|
|
340
|
-
popoverScreenReaderText: ___EmotionJSX(EuiI18n, {
|
|
341
|
-
token: "euiDataGridHeaderCell.actionsPopoverScreenReaderText",
|
|
342
|
-
default: "To navigate through the list of column actions, press the Tab or Up and Down arrow keys."
|
|
343
|
-
})
|
|
344
|
-
};
|
|
345
|
-
};
|
|
125
|
+
EuiDataGridHeaderCell.displayName = 'EuiDataGridHeaderCell';
|
|
@@ -22,6 +22,6 @@ export var euiDataGridHeaderCellStyles = function euiDataGridHeaderCellStyles(eu
|
|
|
22
22
|
// Numeric and currency schemas are aligned to the right
|
|
23
23
|
right: /*#__PURE__*/css(logicalTextAlignCSS('right'), ";;label:right;"),
|
|
24
24
|
euiDataGridHeaderCell__popover: /*#__PURE__*/css(logicalCSS('margin-left', 'auto'), "line-height:0;;label:euiDataGridHeaderCell__popover;"),
|
|
25
|
-
|
|
25
|
+
euiDataGridHeaderCell__actions: /*#__PURE__*/css("overflow:hidden;display:flex;", header.hideActions, " &{", logicalCSS('width', 0), " opacity:0;}", euiCanAnimate, "{transition:inline-size ", euiTheme.animation.fast, " ease-in,opacity ", euiTheme.animation.slow, " ease-in;transform:none!important;animation:none!important;};label:euiDataGridHeaderCell__actions;")
|
|
26
26
|
};
|
|
27
27
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
4
|
-
var _excluded = ["id", "index", "
|
|
4
|
+
var _excluded = ["id", "index", "isLastColumn", "width", "className", "children", "hasColumnActions", "isDragging", "onKeyDown", "aria-label"];
|
|
5
5
|
/*
|
|
6
6
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
7
7
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
@@ -26,12 +26,13 @@ import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
|
26
26
|
export var EuiDataGridHeaderCellWrapper = function EuiDataGridHeaderCellWrapper(_ref) {
|
|
27
27
|
var id = _ref.id,
|
|
28
28
|
index = _ref.index,
|
|
29
|
-
|
|
29
|
+
isLastColumn = _ref.isLastColumn,
|
|
30
30
|
width = _ref.width,
|
|
31
31
|
className = _ref.className,
|
|
32
32
|
children = _ref.children,
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
hasColumnActions = _ref.hasColumnActions,
|
|
34
|
+
isDragging = _ref.isDragging,
|
|
35
|
+
_onKeyDown = _ref.onKeyDown,
|
|
35
36
|
ariaLabel = _ref['aria-label'],
|
|
36
37
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
37
38
|
var classes = classnames('euiDataGridHeaderCell', className);
|
|
@@ -52,8 +53,8 @@ export var EuiDataGridHeaderCellWrapper = function EuiDataGridHeaderCellWrapper(
|
|
|
52
53
|
setInteractiveChildren = _useState6[1];
|
|
53
54
|
useEffect(function () {
|
|
54
55
|
// We're checking for interactive children outside of the default actions button
|
|
55
|
-
setRenderFocusTrap(interactiveChildren.length > (
|
|
56
|
-
}, [
|
|
56
|
+
setRenderFocusTrap(interactiveChildren.length > (hasColumnActions ? 1 : 0));
|
|
57
|
+
}, [hasColumnActions, interactiveChildren]);
|
|
57
58
|
var _useContext = useContext(DataGridFocusContext),
|
|
58
59
|
setFocusedCell = _useContext.setFocusedCell,
|
|
59
60
|
onFocusUpdate = _useContext.onFocusUpdate;
|
|
@@ -75,14 +76,14 @@ export var EuiDataGridHeaderCellWrapper = function EuiDataGridHeaderCellWrapper(
|
|
|
75
76
|
}
|
|
76
77
|
});
|
|
77
78
|
}, [index, onFocusUpdate, headerEl]);
|
|
78
|
-
|
|
79
|
-
// For cell headers with only actions, auto-open the actions popover on enter keypress
|
|
80
79
|
var onKeyDown = useCallback(function (e) {
|
|
81
|
-
|
|
82
|
-
|
|
80
|
+
// Ignore keys that conflict with the focus trap being entered/exited
|
|
81
|
+
if (renderFocusTrap && (e.key === keys.ENTER || e.key === keys.ESCAPE)) {
|
|
82
|
+
return;
|
|
83
83
|
}
|
|
84
|
-
|
|
85
|
-
|
|
84
|
+
// Otherwise, continue with whatever onKeyDown is being passed
|
|
85
|
+
_onKeyDown === null || _onKeyDown === void 0 || _onKeyDown(e);
|
|
86
|
+
}, [_onKeyDown, renderFocusTrap]);
|
|
86
87
|
return ___EmotionJSX("div", _extends({
|
|
87
88
|
role: "columnheader",
|
|
88
89
|
ref: setHeaderEl,
|
|
@@ -100,9 +101,9 @@ export var EuiDataGridHeaderCellWrapper = function EuiDataGridHeaderCellWrapper(
|
|
|
100
101
|
} : {},
|
|
101
102
|
"aria-label": renderFocusTrap ? ariaLabel : undefined
|
|
102
103
|
}, rest), ___EmotionJSX(HandleInteractiveChildren, {
|
|
103
|
-
cellEl: headerEl,
|
|
104
|
+
cellEl: isDragging ? null : headerEl,
|
|
105
|
+
renderFocusTrap: isDragging ? false : renderFocusTrap,
|
|
104
106
|
updateCellFocusContext: updateCellFocusContext,
|
|
105
|
-
renderFocusTrap: renderFocusTrap,
|
|
106
107
|
onInteractiveChildrenFound: setInteractiveChildren
|
|
107
108
|
}, typeof children === 'function' ? children(renderFocusTrap) : children), isLastColumn ? tabularCopyMarkers.hiddenNewline : tabularCopyMarkers.hiddenTab);
|
|
108
109
|
};
|
|
@@ -20,8 +20,7 @@ export var euiDataGridHeaderCellWrapperStyles = function euiDataGridHeaderCellWr
|
|
|
20
20
|
hoverStyles = _euiDataGridCellOutli.hoverStyles;
|
|
21
21
|
var _euiDataGridCellOutli2 = euiDataGridCellOutlineSelectors(),
|
|
22
22
|
outlineSelectors = _euiDataGridCellOutli2.header;
|
|
23
|
-
var _sharedFlexCss = /*#__PURE__*/css("display:flex;align-items:center;gap:", euiTheme.size.xxs, ";");
|
|
24
23
|
return {
|
|
25
|
-
euiDataGridHeaderCell: /*#__PURE__*/css("position:relative;
|
|
24
|
+
euiDataGridHeaderCell: /*#__PURE__*/css("position:relative;display:flex;align-items:center;flex:0 0 auto;font-weight:", euiTheme.font.weight.bold, ";", outlineSelectors.focus, "{", focusStyles, ";}", outlineSelectors.focusTrapped, "{", hoverStyles, ";}", outlineSelectors.showActions, "{&,&>[data-focus-lock-disabled]{gap:", euiTheme.size.xxs, ";}}&>[data-focus-lock-disabled]{display:flex;align-items:center;", logicalCSS('width', '100%'), ";};label:euiDataGridHeaderCell;")
|
|
26
25
|
};
|
|
27
26
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
-
var _excluded = ["className", "data-test-subj", "leadingControlColumns", "trailingControlColumns", "columns", "columnWidths", "defaultColumnWidth", "setColumnWidth", "visibleColCount", "setVisibleColumns", "switchColumnPos", "sorting", "schema", "schemaDetectors", "gridStyles"];
|
|
3
|
+
var _excluded = ["className", "data-test-subj", "leadingControlColumns", "trailingControlColumns", "columns", "columnWidths", "defaultColumnWidth", "setColumnWidth", "visibleColCount", "setVisibleColumns", "switchColumnPos", "sorting", "schema", "schemaDetectors", "gridStyles", "canDragAndDropColumns"];
|
|
4
4
|
/*
|
|
5
5
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
6
6
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
@@ -10,14 +10,16 @@ var _excluded = ["className", "data-test-subj", "leadingControlColumns", "traili
|
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
12
|
import classnames from 'classnames';
|
|
13
|
-
import React, { forwardRef, memo } from 'react';
|
|
13
|
+
import React, { forwardRef, memo, useCallback } from 'react';
|
|
14
14
|
import { useEuiMemoizedStyles } from '../../../../services';
|
|
15
15
|
import { emptyControlColumns } from '../../data_grid_types';
|
|
16
|
+
import { ConditionalDroppableColumns } from './draggable_columns';
|
|
16
17
|
import { EuiDataGridControlHeaderCell } from './data_grid_control_header_cell';
|
|
17
18
|
import { EuiDataGridHeaderCell } from './data_grid_header_cell';
|
|
18
19
|
import { euiDataGridHeaderStyles } from './data_grid_header_row.styles';
|
|
19
20
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
20
21
|
var EuiDataGridHeaderRow = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function (props, ref) {
|
|
22
|
+
var _leadingControlColumn;
|
|
21
23
|
var className = props.className,
|
|
22
24
|
_dataTestSubj = props['data-test-subj'],
|
|
23
25
|
_props$leadingControl = props.leadingControlColumns,
|
|
@@ -35,11 +37,15 @@ var EuiDataGridHeaderRow = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function (
|
|
|
35
37
|
schema = props.schema,
|
|
36
38
|
schemaDetectors = props.schemaDetectors,
|
|
37
39
|
gridStyles = props.gridStyles,
|
|
40
|
+
canDragAndDropColumns = props.canDragAndDropColumns,
|
|
38
41
|
rest = _objectWithoutProperties(props, _excluded);
|
|
39
42
|
var styles = useEuiMemoizedStyles(euiDataGridHeaderStyles);
|
|
40
43
|
var cssStyles = [styles.euiDataGridHeader, styles[gridStyles.header]];
|
|
41
44
|
var classes = classnames('euiDataGridHeader', className);
|
|
42
45
|
var dataTestSubj = classnames('dataGridHeader', _dataTestSubj);
|
|
46
|
+
var isLastColumn = useCallback(function (index) {
|
|
47
|
+
return index === visibleColCount - 1;
|
|
48
|
+
}, [visibleColCount]);
|
|
43
49
|
return ___EmotionJSX("div", _extends({
|
|
44
50
|
role: "row",
|
|
45
51
|
ref: ref,
|
|
@@ -50,30 +56,39 @@ var EuiDataGridHeaderRow = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function (
|
|
|
50
56
|
return ___EmotionJSX(EuiDataGridControlHeaderCell, {
|
|
51
57
|
key: controlColumn.id,
|
|
52
58
|
index: index,
|
|
53
|
-
|
|
59
|
+
isLastColumn: isLastColumn(index),
|
|
54
60
|
controlColumn: controlColumn
|
|
55
61
|
});
|
|
56
|
-
}),
|
|
62
|
+
}), ___EmotionJSX(ConditionalDroppableColumns, {
|
|
63
|
+
canDragAndDropColumns: !!canDragAndDropColumns,
|
|
64
|
+
columns: columns,
|
|
65
|
+
switchColumnPos: switchColumnPos,
|
|
66
|
+
indexOffset: (_leadingControlColumn = leadingControlColumns === null || leadingControlColumns === void 0 ? void 0 : leadingControlColumns.length) !== null && _leadingControlColumn !== void 0 ? _leadingControlColumn : 0
|
|
67
|
+
}, columns.map(function (column, index) {
|
|
68
|
+
var visibleIndex = index + leadingControlColumns.length;
|
|
57
69
|
return ___EmotionJSX(EuiDataGridHeaderCell, {
|
|
58
70
|
key: column.id,
|
|
59
|
-
index:
|
|
71
|
+
index: visibleIndex,
|
|
72
|
+
isLastColumn: isLastColumn(visibleIndex),
|
|
60
73
|
column: column,
|
|
61
74
|
columns: columns,
|
|
62
75
|
columnWidths: columnWidths,
|
|
63
76
|
defaultColumnWidth: defaultColumnWidth,
|
|
64
77
|
setColumnWidth: setColumnWidth,
|
|
65
|
-
visibleColCount: visibleColCount,
|
|
66
78
|
setVisibleColumns: setVisibleColumns,
|
|
67
79
|
switchColumnPos: switchColumnPos,
|
|
68
80
|
sorting: sorting,
|
|
69
81
|
schema: schema,
|
|
70
|
-
schemaDetectors: schemaDetectors
|
|
82
|
+
schemaDetectors: schemaDetectors,
|
|
83
|
+
canDragAndDropColumns: canDragAndDropColumns,
|
|
84
|
+
gridStyles: gridStyles
|
|
71
85
|
});
|
|
72
|
-
}), trailingControlColumns.map(function (controlColumn, index) {
|
|
86
|
+
})), trailingControlColumns.map(function (controlColumn, index) {
|
|
87
|
+
var visibleIndex = index + leadingControlColumns.length + columns.length;
|
|
73
88
|
return ___EmotionJSX(EuiDataGridControlHeaderCell, {
|
|
74
89
|
key: controlColumn.id,
|
|
75
|
-
index:
|
|
76
|
-
|
|
90
|
+
index: visibleIndex,
|
|
91
|
+
isLastColumn: isLastColumn(visibleIndex),
|
|
77
92
|
controlColumn: controlColumn
|
|
78
93
|
});
|
|
79
94
|
}));
|