@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
|
@@ -5,23 +5,19 @@ var _typeof = require("@babel/runtime/helpers/typeof");
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.
|
|
8
|
+
exports.EuiDataGridHeaderCell = void 0;
|
|
9
9
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
10
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
11
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
12
12
|
var _classnames2 = _interopRequireDefault(require("classnames"));
|
|
13
13
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
14
14
|
var _react = _interopRequireWildcard(require("react"));
|
|
15
|
-
var _tabbable = require("tabbable");
|
|
16
15
|
var _services = require("../../../../services");
|
|
17
|
-
var _i18n = require("../../../i18n");
|
|
18
16
|
var _icon = require("../../../icon");
|
|
19
|
-
var _list_group = require("../../../list_group");
|
|
20
|
-
var _popover = require("../../../popover");
|
|
21
|
-
var _button = require("../../../button");
|
|
22
|
-
var _focus = require("../../utils/focus");
|
|
23
17
|
var _column_actions = require("./column_actions");
|
|
24
|
-
var
|
|
18
|
+
var _column_sorting = require("./column_sorting");
|
|
19
|
+
var _draggable_columns = require("./draggable_columns");
|
|
20
|
+
var _column_resizer = require("./column_resizer");
|
|
25
21
|
var _data_grid_header_cell_wrapper = require("./data_grid_header_cell_wrapper");
|
|
26
22
|
var _data_grid_header_cell = require("./data_grid_header_cell.styles");
|
|
27
23
|
var _react2 = require("@emotion/react");
|
|
@@ -42,153 +38,103 @@ var EuiDataGridHeaderCell = exports.EuiDataGridHeaderCell = /*#__PURE__*/(0, _re
|
|
|
42
38
|
columnWidths = _ref.columnWidths,
|
|
43
39
|
defaultColumnWidth = _ref.defaultColumnWidth,
|
|
44
40
|
setColumnWidth = _ref.setColumnWidth,
|
|
45
|
-
visibleColCount = _ref.visibleColCount,
|
|
46
41
|
setVisibleColumns = _ref.setVisibleColumns,
|
|
47
42
|
switchColumnPos = _ref.switchColumnPos,
|
|
43
|
+
isLastColumn = _ref.isLastColumn,
|
|
48
44
|
sorting = _ref.sorting,
|
|
49
45
|
schema = _ref.schema,
|
|
50
|
-
schemaDetectors = _ref.schemaDetectors
|
|
46
|
+
schemaDetectors = _ref.schemaDetectors,
|
|
47
|
+
canDragAndDropColumns = _ref.canDragAndDropColumns,
|
|
48
|
+
gridStyles = _ref.gridStyles;
|
|
51
49
|
var id = column.id,
|
|
52
50
|
display = column.display,
|
|
53
51
|
displayAsText = column.displayAsText,
|
|
54
|
-
displayHeaderCellProps = column.displayHeaderCellProps
|
|
52
|
+
displayHeaderCellProps = column.displayHeaderCellProps,
|
|
53
|
+
actions = column.actions;
|
|
55
54
|
var title = displayAsText || id;
|
|
56
55
|
var children = display || displayAsText || id;
|
|
57
56
|
var width = columnWidths[id] || defaultColumnWidth;
|
|
58
57
|
var columnType = schema[id] ? schema[id].columnType : null;
|
|
59
|
-
var
|
|
60
|
-
|
|
61
|
-
|
|
58
|
+
var hasColumnActions = (0, _column_actions.useHasColumnActions)(actions);
|
|
59
|
+
var classes = (0, _classnames2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)({}, "euiDataGridHeaderCell--".concat(columnType), columnType), 'euiDataGridHeaderCell--hasColumnActions', hasColumnActions), displayHeaderCellProps === null || displayHeaderCellProps === void 0 ? void 0 : displayHeaderCellProps.className);
|
|
60
|
+
var styles = (0, _services.useEuiMemoizedStyles)(_data_grid_header_cell.euiDataGridHeaderCellStyles);
|
|
61
|
+
var contentStyles = [styles.euiDataGridHeaderCell__content, (columnType === 'numeric' || columnType === 'currency') && styles.right];
|
|
62
62
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
*/
|
|
66
|
-
var _useState = (0, _react.useState)(false),
|
|
63
|
+
// Props passed from <ColumnActions /> to be set on <EuiDataGridHeaderCellWrapper />
|
|
64
|
+
var _useState = (0, _react.useState)({}),
|
|
67
65
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
var togglePopover = (0, _react.useCallback)(function () {
|
|
71
|
-
setIsPopoverOpen(function (isOpen) {
|
|
72
|
-
return !isOpen;
|
|
73
|
-
});
|
|
74
|
-
}, []);
|
|
75
|
-
var closePopover = (0, _react.useCallback)(function () {
|
|
76
|
-
return setIsPopoverOpen(false);
|
|
77
|
-
}, []);
|
|
78
|
-
var popoverArrowNavigationProps = usePopoverArrowNavigation();
|
|
79
|
-
var columnActions = (0, _react.useMemo)(function () {
|
|
80
|
-
return (0, _column_actions.getColumnActions)({
|
|
81
|
-
column: column,
|
|
82
|
-
columns: columns,
|
|
83
|
-
schema: schema,
|
|
84
|
-
schemaDetectors: schemaDetectors,
|
|
85
|
-
setVisibleColumns: setVisibleColumns,
|
|
86
|
-
focusFirstVisibleInteractiveCell: focusFirstVisibleInteractiveCell,
|
|
87
|
-
setIsPopoverOpen: setIsPopoverOpen,
|
|
88
|
-
sorting: sorting,
|
|
89
|
-
switchColumnPos: switchColumnPos,
|
|
90
|
-
setFocusedCell: setFocusedCell,
|
|
91
|
-
columnFocusIndex: index
|
|
92
|
-
});
|
|
93
|
-
}, [column, columns, schema, schemaDetectors, setVisibleColumns, focusFirstVisibleInteractiveCell, setIsPopoverOpen, sorting, switchColumnPos, setFocusedCell, index]);
|
|
94
|
-
var showColumnActions = columnActions && columnActions.length > 0;
|
|
66
|
+
propsFromColumnActions = _useState2[0],
|
|
67
|
+
setPropsFromColumnActions = _useState2[1];
|
|
95
68
|
var actionsButtonRef = (0, _react.useRef)(null);
|
|
96
|
-
var
|
|
97
|
-
var _actionsButtonRef$cur;
|
|
98
|
-
(_actionsButtonRef$cur = actionsButtonRef.current) === null || _actionsButtonRef$cur === void 0 || _actionsButtonRef$cur.click();
|
|
99
|
-
}, []);
|
|
100
|
-
var _useState3 = (0, _react.useState)(false),
|
|
101
|
-
_useState4 = (0, _slicedToArray2.default)(_useState3, 2),
|
|
102
|
-
isActionsButtonFocused = _useState4[0],
|
|
103
|
-
setIsActionsButtonFocused = _useState4[1];
|
|
104
|
-
var actionsButtonAriaLabel = (0, _i18n.useEuiI18n)('euiDataGridHeaderCell.actionsButtonAriaLabel', '{title}. Click to view column header actions.', {
|
|
105
|
-
title: title
|
|
106
|
-
});
|
|
107
|
-
var actionsEnterKeyInstructions = (0, _i18n.useEuiI18n)('euiDataGridHeaderCell.actionsEnterKeyInstructions', "Press the Enter key to view this column's actions");
|
|
108
|
-
|
|
109
|
-
/*
|
|
110
|
-
* Column sorting
|
|
111
|
-
*/
|
|
112
|
-
var _useSortingUtils = useSortingUtils({
|
|
69
|
+
var _useColumnSorting = (0, _column_sorting.useColumnSorting)({
|
|
113
70
|
sorting: sorting,
|
|
114
71
|
id: id,
|
|
115
|
-
|
|
72
|
+
hasColumnActions: hasColumnActions
|
|
116
73
|
}),
|
|
117
|
-
sortingArrow =
|
|
118
|
-
ariaSort =
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
});
|
|
124
|
-
|
|
125
|
-
/*
|
|
126
|
-
* Rendering
|
|
127
|
-
*/
|
|
128
|
-
var classes = (0, _classnames2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)({}, "euiDataGridHeaderCell--".concat(columnType), columnType), 'euiDataGridHeaderCell--hasColumnActions', showColumnActions), 'euiDataGridHeaderCell--isActionsPopoverOpen', isPopoverOpen), displayHeaderCellProps === null || displayHeaderCellProps === void 0 ? void 0 : displayHeaderCellProps.className);
|
|
129
|
-
var styles = (0, _services.useEuiMemoizedStyles)(_data_grid_header_cell.euiDataGridHeaderCellStyles);
|
|
130
|
-
var contentStyles = [styles.euiDataGridHeaderCell__content, (columnType === 'numeric' || columnType === 'currency') && styles.right];
|
|
131
|
-
return (0, _react2.jsx)(_data_grid_header_cell_wrapper.EuiDataGridHeaderCellWrapper, (0, _extends2.default)({}, displayHeaderCellProps, {
|
|
132
|
-
className: classes,
|
|
133
|
-
id: id,
|
|
134
|
-
index: index,
|
|
135
|
-
visibleColCount: visibleColCount,
|
|
136
|
-
width: width,
|
|
137
|
-
"aria-sort": ariaSort,
|
|
138
|
-
hasActionsPopover: showColumnActions,
|
|
139
|
-
openActionsPopover: clickActionsButton,
|
|
140
|
-
"aria-label": displayAsText && "".concat(displayAsText, ", ") // ensure cell text content is read first, if available
|
|
141
|
-
,
|
|
142
|
-
"aria-describedby": sortingAriaId
|
|
143
|
-
}), function (hasFocusTrap) {
|
|
144
|
-
return (0, _react2.jsx)(_react.default.Fragment, null, column.isResizable !== false && width != null ? (0, _react2.jsx)(_data_grid_column_resizer.EuiDataGridColumnResizer, {
|
|
74
|
+
sortingArrow = _useColumnSorting.sortingArrow,
|
|
75
|
+
ariaSort = _useColumnSorting.ariaSort,
|
|
76
|
+
sortingAriaId = _useColumnSorting.sortingAriaId,
|
|
77
|
+
sortingScreenReaderText = _useColumnSorting.sortingScreenReaderText;
|
|
78
|
+
var columnResizer = (0, _react.useMemo)(function () {
|
|
79
|
+
return column.isResizable !== false && width != null ? (0, _react2.jsx)(_column_resizer.EuiDataGridColumnResizer, {
|
|
145
80
|
columnId: id,
|
|
146
81
|
columnWidth: width,
|
|
147
|
-
setColumnWidth: setColumnWidth
|
|
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
|
-
"
|
|
178
|
-
:
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
82
|
+
setColumnWidth: setColumnWidth,
|
|
83
|
+
isLastColumn: isLastColumn
|
|
84
|
+
}) : null;
|
|
85
|
+
}, [column.isResizable, id, width, setColumnWidth, isLastColumn]);
|
|
86
|
+
return (0, _react2.jsx)(_draggable_columns.ConditionalDraggableColumn, {
|
|
87
|
+
id: id,
|
|
88
|
+
index: index,
|
|
89
|
+
canDragAndDropColumns: !!canDragAndDropColumns,
|
|
90
|
+
gridStyles: gridStyles,
|
|
91
|
+
columnResizer: columnResizer,
|
|
92
|
+
actionsPopoverToggle: actionsButtonRef.current
|
|
93
|
+
}, function (dragProps) {
|
|
94
|
+
return (0, _react2.jsx)(_data_grid_header_cell_wrapper.EuiDataGridHeaderCellWrapper, (0, _extends2.default)({}, displayHeaderCellProps, dragProps, {
|
|
95
|
+
hasColumnActions: hasColumnActions
|
|
96
|
+
}, propsFromColumnActions, {
|
|
97
|
+
className: (0, _classnames2.default)(classes, propsFromColumnActions.className),
|
|
98
|
+
id: id,
|
|
99
|
+
index: index,
|
|
100
|
+
isLastColumn: isLastColumn,
|
|
101
|
+
width: width,
|
|
102
|
+
"aria-sort": ariaSort,
|
|
103
|
+
"aria-label": displayAsText && "".concat(displayAsText, ", ") // ensure cell text content is read first, if available
|
|
104
|
+
,
|
|
105
|
+
"aria-describedby": (0, _classnames2.default)(sortingAriaId, dragProps === null || dragProps === void 0 ? void 0 : dragProps['aria-describedby']),
|
|
106
|
+
"data-column-moving": propsFromColumnActions['data-column-moving'] || (dragProps === null || dragProps === void 0 ? void 0 : dragProps['data-column-moving']) || undefined
|
|
107
|
+
}), function (hasFocusTrap) {
|
|
108
|
+
return (0, _react2.jsx)(_react.default.Fragment, null, !canDragAndDropColumns && columnResizer, canDragAndDropColumns && (0, _react2.jsx)("span", {
|
|
109
|
+
className: "euiDataGridHeaderCell__draggableIcon"
|
|
110
|
+
}, (0, _react2.jsx)(_icon.EuiIcon, {
|
|
111
|
+
type: "grabOmnidirectional",
|
|
112
|
+
size: "s",
|
|
113
|
+
css: styles.euiDataGridHeaderCell__actions
|
|
114
|
+
})), (0, _react2.jsx)("div", {
|
|
115
|
+
css: contentStyles,
|
|
116
|
+
className: "euiDataGridHeaderCell__content",
|
|
117
|
+
title: title
|
|
118
|
+
}, children), sortingArrow, sortingScreenReaderText, hasColumnActions && (0, _react2.jsx)(_column_actions.ColumnActions, {
|
|
119
|
+
index: index,
|
|
120
|
+
id: id,
|
|
121
|
+
title: title,
|
|
122
|
+
column: column,
|
|
123
|
+
columns: columns,
|
|
124
|
+
schema: schema,
|
|
125
|
+
schemaDetectors: schemaDetectors,
|
|
126
|
+
setVisibleColumns: setVisibleColumns,
|
|
127
|
+
switchColumnPos: switchColumnPos,
|
|
128
|
+
sorting: sorting,
|
|
129
|
+
hasFocusTrap: hasFocusTrap,
|
|
130
|
+
setPropsFromColumnActions: setPropsFromColumnActions,
|
|
131
|
+
actionsButtonRef: actionsButtonRef
|
|
132
|
+
}));
|
|
133
|
+
});
|
|
189
134
|
});
|
|
190
135
|
});
|
|
191
136
|
EuiDataGridHeaderCell.propTypes = {
|
|
137
|
+
index: _propTypes.default.number.isRequired,
|
|
192
138
|
column: _propTypes.default.shape({
|
|
193
139
|
/**
|
|
194
140
|
* The unique identifier for this column
|
|
@@ -585,171 +531,6 @@ EuiDataGridHeaderCell.propTypes = {
|
|
|
585
531
|
*/
|
|
586
532
|
visibleCellActions: _propTypes.default.number
|
|
587
533
|
}).isRequired,
|
|
588
|
-
|
|
534
|
+
isLastColumn: _propTypes.default.bool.isRequired
|
|
589
535
|
};
|
|
590
|
-
EuiDataGridHeaderCell.displayName = 'EuiDataGridHeaderCell';
|
|
591
|
-
|
|
592
|
-
/**
|
|
593
|
-
* Column sorting utility helpers
|
|
594
|
-
*/
|
|
595
|
-
var useSortingUtils = exports.useSortingUtils = function useSortingUtils(_ref2) {
|
|
596
|
-
var _sorting$columns;
|
|
597
|
-
var sorting = _ref2.sorting,
|
|
598
|
-
id = _ref2.id,
|
|
599
|
-
showColumnActions = _ref2.showColumnActions;
|
|
600
|
-
var sortedColumn = (0, _react.useMemo)(function () {
|
|
601
|
-
return sorting === null || sorting === void 0 ? void 0 : sorting.columns.find(function (col) {
|
|
602
|
-
return col.id === id;
|
|
603
|
-
});
|
|
604
|
-
}, [sorting, id]);
|
|
605
|
-
var isColumnSorted = !!sortedColumn;
|
|
606
|
-
var hasOnlyOneSort = (sorting === null || sorting === void 0 || (_sorting$columns = sorting.columns) === null || _sorting$columns === void 0 ? void 0 : _sorting$columns.length) === 1;
|
|
607
|
-
|
|
608
|
-
/**
|
|
609
|
-
* Arrow icon
|
|
610
|
-
*/
|
|
611
|
-
var sortingArrow = (0, _react.useMemo)(function () {
|
|
612
|
-
return isColumnSorted ? (0, _react2.jsx)(_icon.EuiIcon, {
|
|
613
|
-
type: sortedColumn.direction === 'asc' ? 'sortUp' : 'sortDown',
|
|
614
|
-
color: "text",
|
|
615
|
-
className: "euiDataGridHeaderCell__sortingArrow",
|
|
616
|
-
"data-test-subj": "dataGridHeaderCellSortingIcon-".concat(id)
|
|
617
|
-
}) : null;
|
|
618
|
-
}, [id, isColumnSorted, sortedColumn]);
|
|
619
|
-
|
|
620
|
-
/**
|
|
621
|
-
* aria-sort attribute - should only be used when a single column is being sorted
|
|
622
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-sort
|
|
623
|
-
* @see https://www.w3.org/WAI/ARIA/apg/example-index/table/sortable-table.html
|
|
624
|
-
* @see https://github.com/w3c/aria/issues/283 for potential future multi-column usage
|
|
625
|
-
*/
|
|
626
|
-
var ariaSort = isColumnSorted && hasOnlyOneSort ? sorting.columns[0].direction === 'asc' ? 'ascending' : 'descending' : undefined;
|
|
627
|
-
|
|
628
|
-
/**
|
|
629
|
-
* Sorting status - screen reader text
|
|
630
|
-
*/
|
|
631
|
-
var sortingScreenReaderText = (0, _react.useMemo)(function () {
|
|
632
|
-
var _sorting$columns2;
|
|
633
|
-
if (!isColumnSorted) return null;
|
|
634
|
-
if (!showColumnActions && hasOnlyOneSort) return null; // in this scenario, the `aria-sort` attribute will be used by screen readers
|
|
635
|
-
return (0, _react2.jsx)(_react.default.Fragment, null, sorting === null || sorting === void 0 || (_sorting$columns2 = sorting.columns) === null || _sorting$columns2 === void 0 ? void 0 : _sorting$columns2.map(function (_ref3, index) {
|
|
636
|
-
var columnId = _ref3.id,
|
|
637
|
-
direction = _ref3.direction;
|
|
638
|
-
if (hasOnlyOneSort) {
|
|
639
|
-
if (direction === 'asc') {
|
|
640
|
-
return (0, _react2.jsx)(_i18n.EuiI18n, {
|
|
641
|
-
token: "euiDataGridHeaderCell.sortedByAscendingSingle",
|
|
642
|
-
default: "Sorted ascending",
|
|
643
|
-
key: index
|
|
644
|
-
});
|
|
645
|
-
} else {
|
|
646
|
-
return (0, _react2.jsx)(_i18n.EuiI18n, {
|
|
647
|
-
token: "euiDataGridHeaderCell.sortedByDescendingSingle",
|
|
648
|
-
default: "Sorted descending",
|
|
649
|
-
key: index
|
|
650
|
-
});
|
|
651
|
-
}
|
|
652
|
-
} else if (index === 0) {
|
|
653
|
-
if (direction === 'asc') {
|
|
654
|
-
return (0, _react2.jsx)(_i18n.EuiI18n, {
|
|
655
|
-
token: "euiDataGridHeaderCell.sortedByAscendingFirst",
|
|
656
|
-
default: "Sorted by {columnId}, ascending",
|
|
657
|
-
values: {
|
|
658
|
-
columnId: columnId
|
|
659
|
-
},
|
|
660
|
-
key: index
|
|
661
|
-
});
|
|
662
|
-
} else {
|
|
663
|
-
return (0, _react2.jsx)(_i18n.EuiI18n, {
|
|
664
|
-
token: "euiDataGridHeaderCell.sortedByDescendingFirst",
|
|
665
|
-
default: "Sorted by {columnId}, descending",
|
|
666
|
-
values: {
|
|
667
|
-
columnId: columnId
|
|
668
|
-
},
|
|
669
|
-
key: index
|
|
670
|
-
});
|
|
671
|
-
}
|
|
672
|
-
} else {
|
|
673
|
-
if (direction === 'asc') {
|
|
674
|
-
return (0, _react2.jsx)(_i18n.EuiI18n, {
|
|
675
|
-
token: "euiDataGridHeaderCell.sortedByAscendingMultiple",
|
|
676
|
-
default: ", then sorted by {columnId}, ascending",
|
|
677
|
-
values: {
|
|
678
|
-
columnId: columnId
|
|
679
|
-
},
|
|
680
|
-
key: index
|
|
681
|
-
});
|
|
682
|
-
} else {
|
|
683
|
-
return (0, _react2.jsx)(_i18n.EuiI18n, {
|
|
684
|
-
token: "euiDataGridHeaderCell.sortedByDescendingMultiple",
|
|
685
|
-
default: ", then sorted by {columnId}, descending",
|
|
686
|
-
values: {
|
|
687
|
-
columnId: columnId
|
|
688
|
-
},
|
|
689
|
-
key: index
|
|
690
|
-
});
|
|
691
|
-
}
|
|
692
|
-
}
|
|
693
|
-
}), ".");
|
|
694
|
-
}, [isColumnSorted, showColumnActions, hasOnlyOneSort, sorting]);
|
|
695
|
-
return {
|
|
696
|
-
sortingArrow: sortingArrow,
|
|
697
|
-
ariaSort: ariaSort,
|
|
698
|
-
sortingScreenReaderText: sortingScreenReaderText
|
|
699
|
-
};
|
|
700
|
-
};
|
|
701
|
-
|
|
702
|
-
/**
|
|
703
|
-
* Add keyboard arrow navigation to the cell actions popover
|
|
704
|
-
* to match the UX of the rest of EuiDataGrid
|
|
705
|
-
*/
|
|
706
|
-
var usePopoverArrowNavigation = exports.usePopoverArrowNavigation = function usePopoverArrowNavigation() {
|
|
707
|
-
var popoverPanelRef = (0, _react.useRef)(null);
|
|
708
|
-
var actionsRef = (0, _react.useRef)(undefined);
|
|
709
|
-
var panelRef = (0, _react.useCallback)(function (ref) {
|
|
710
|
-
popoverPanelRef.current = ref;
|
|
711
|
-
actionsRef.current = ref ? (0, _tabbable.tabbable)(ref) : undefined;
|
|
712
|
-
}, []);
|
|
713
|
-
var onKeyDown = (0, _react.useCallback)(function (e) {
|
|
714
|
-
var _actionsRef$current;
|
|
715
|
-
if (e.key !== _services.keys.ARROW_DOWN && e.key !== _services.keys.ARROW_UP) return;
|
|
716
|
-
if (!((_actionsRef$current = actionsRef.current) !== null && _actionsRef$current !== void 0 && _actionsRef$current.length)) return;
|
|
717
|
-
e.preventDefault();
|
|
718
|
-
var initialState = document.activeElement === popoverPanelRef.current;
|
|
719
|
-
var currentIndex = !initialState ? actionsRef.current.findIndex(function (el) {
|
|
720
|
-
return document.activeElement === el;
|
|
721
|
-
}) : -1;
|
|
722
|
-
var lastIndex = actionsRef.current.length - 1;
|
|
723
|
-
var indexToFocus;
|
|
724
|
-
if (initialState) {
|
|
725
|
-
if (e.key === _services.keys.ARROW_DOWN) {
|
|
726
|
-
indexToFocus = 0;
|
|
727
|
-
} else if (e.key === _services.keys.ARROW_UP) {
|
|
728
|
-
indexToFocus = lastIndex;
|
|
729
|
-
}
|
|
730
|
-
} else {
|
|
731
|
-
if (e.key === _services.keys.ARROW_DOWN) {
|
|
732
|
-
indexToFocus = currentIndex + 1;
|
|
733
|
-
if (indexToFocus > lastIndex) {
|
|
734
|
-
indexToFocus = 0;
|
|
735
|
-
}
|
|
736
|
-
} else if (e.key === _services.keys.ARROW_UP) {
|
|
737
|
-
indexToFocus = currentIndex - 1;
|
|
738
|
-
if (indexToFocus < 0) {
|
|
739
|
-
indexToFocus = lastIndex;
|
|
740
|
-
}
|
|
741
|
-
}
|
|
742
|
-
}
|
|
743
|
-
actionsRef.current[indexToFocus].focus();
|
|
744
|
-
}, []);
|
|
745
|
-
return {
|
|
746
|
-
panelRef: panelRef,
|
|
747
|
-
panelProps: {
|
|
748
|
-
onKeyDown: onKeyDown
|
|
749
|
-
},
|
|
750
|
-
popoverScreenReaderText: (0, _react2.jsx)(_i18n.EuiI18n, {
|
|
751
|
-
token: "euiDataGridHeaderCell.actionsPopoverScreenReaderText",
|
|
752
|
-
default: "To navigate through the list of column actions, press the Tab or Up and Down arrow keys."
|
|
753
|
-
})
|
|
754
|
-
};
|
|
755
|
-
};
|
|
536
|
+
EuiDataGridHeaderCell.displayName = 'EuiDataGridHeaderCell';
|
|
@@ -27,6 +27,6 @@ var euiDataGridHeaderCellStyles = exports.euiDataGridHeaderCellStyles = function
|
|
|
27
27
|
// Numeric and currency schemas are aligned to the right
|
|
28
28
|
right: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalTextAlignCSS)('right'), ";;label:right;"),
|
|
29
29
|
euiDataGridHeaderCell__popover: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('margin-left', 'auto'), "line-height:0;;label:euiDataGridHeaderCell__popover;"),
|
|
30
|
-
|
|
30
|
+
euiDataGridHeaderCell__actions: /*#__PURE__*/(0, _react.css)("overflow:hidden;display:flex;", header.hideActions, " &{", (0, _global_styling.logicalCSS)('width', 0), " opacity:0;}", _global_styling.euiCanAnimate, "{transition:inline-size ", euiTheme.animation.fast, " ease-in,opacity ", euiTheme.animation.slow, " ease-in;transform:none!important;animation:none!important;};label:euiDataGridHeaderCell__actions;")
|
|
31
31
|
};
|
|
32
32
|
};
|
|
@@ -17,7 +17,7 @@ var _focus = require("../../utils/focus");
|
|
|
17
17
|
var _focus_utils = require("../cell/focus_utils");
|
|
18
18
|
var _data_grid_header_cell_wrapper = require("./data_grid_header_cell_wrapper.styles");
|
|
19
19
|
var _react2 = require("@emotion/react");
|
|
20
|
-
var _excluded = ["id", "index", "
|
|
20
|
+
var _excluded = ["id", "index", "isLastColumn", "width", "className", "children", "hasColumnActions", "isDragging", "onKeyDown", "aria-label"];
|
|
21
21
|
/*
|
|
22
22
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
23
23
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
@@ -35,12 +35,13 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
|
|
|
35
35
|
var EuiDataGridHeaderCellWrapper = exports.EuiDataGridHeaderCellWrapper = function EuiDataGridHeaderCellWrapper(_ref) {
|
|
36
36
|
var id = _ref.id,
|
|
37
37
|
index = _ref.index,
|
|
38
|
-
|
|
38
|
+
isLastColumn = _ref.isLastColumn,
|
|
39
39
|
width = _ref.width,
|
|
40
40
|
className = _ref.className,
|
|
41
41
|
children = _ref.children,
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
hasColumnActions = _ref.hasColumnActions,
|
|
43
|
+
isDragging = _ref.isDragging,
|
|
44
|
+
_onKeyDown = _ref.onKeyDown,
|
|
44
45
|
ariaLabel = _ref['aria-label'],
|
|
45
46
|
rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
46
47
|
var classes = (0, _classnames.default)('euiDataGridHeaderCell', className);
|
|
@@ -61,8 +62,8 @@ var EuiDataGridHeaderCellWrapper = exports.EuiDataGridHeaderCellWrapper = functi
|
|
|
61
62
|
setInteractiveChildren = _useState6[1];
|
|
62
63
|
(0, _react.useEffect)(function () {
|
|
63
64
|
// We're checking for interactive children outside of the default actions button
|
|
64
|
-
setRenderFocusTrap(interactiveChildren.length > (
|
|
65
|
-
}, [
|
|
65
|
+
setRenderFocusTrap(interactiveChildren.length > (hasColumnActions ? 1 : 0));
|
|
66
|
+
}, [hasColumnActions, interactiveChildren]);
|
|
66
67
|
var _useContext = (0, _react.useContext)(_focus.DataGridFocusContext),
|
|
67
68
|
setFocusedCell = _useContext.setFocusedCell,
|
|
68
69
|
onFocusUpdate = _useContext.onFocusUpdate;
|
|
@@ -84,14 +85,14 @@ var EuiDataGridHeaderCellWrapper = exports.EuiDataGridHeaderCellWrapper = functi
|
|
|
84
85
|
}
|
|
85
86
|
});
|
|
86
87
|
}, [index, onFocusUpdate, headerEl]);
|
|
87
|
-
|
|
88
|
-
// For cell headers with only actions, auto-open the actions popover on enter keypress
|
|
89
88
|
var onKeyDown = (0, _react.useCallback)(function (e) {
|
|
90
|
-
|
|
91
|
-
|
|
89
|
+
// Ignore keys that conflict with the focus trap being entered/exited
|
|
90
|
+
if (renderFocusTrap && (e.key === _services.keys.ENTER || e.key === _services.keys.ESCAPE)) {
|
|
91
|
+
return;
|
|
92
92
|
}
|
|
93
|
-
|
|
94
|
-
|
|
93
|
+
// Otherwise, continue with whatever onKeyDown is being passed
|
|
94
|
+
_onKeyDown === null || _onKeyDown === void 0 || _onKeyDown(e);
|
|
95
|
+
}, [_onKeyDown, renderFocusTrap]);
|
|
95
96
|
return (0, _react2.jsx)("div", (0, _extends2.default)({
|
|
96
97
|
role: "columnheader",
|
|
97
98
|
ref: setHeaderEl,
|
|
@@ -109,9 +110,9 @@ var EuiDataGridHeaderCellWrapper = exports.EuiDataGridHeaderCellWrapper = functi
|
|
|
109
110
|
} : {},
|
|
110
111
|
"aria-label": renderFocusTrap ? ariaLabel : undefined
|
|
111
112
|
}, rest), (0, _react2.jsx)(_focus_utils.HandleInteractiveChildren, {
|
|
112
|
-
cellEl: headerEl,
|
|
113
|
+
cellEl: isDragging ? null : headerEl,
|
|
114
|
+
renderFocusTrap: isDragging ? false : renderFocusTrap,
|
|
113
115
|
updateCellFocusContext: updateCellFocusContext,
|
|
114
|
-
renderFocusTrap: renderFocusTrap,
|
|
115
116
|
onInteractiveChildrenFound: setInteractiveChildren
|
|
116
117
|
}, typeof children === 'function' ? children(renderFocusTrap) : children), isLastColumn ? _services.tabularCopyMarkers.hiddenNewline : _services.tabularCopyMarkers.hiddenTab);
|
|
117
118
|
};
|
|
@@ -119,10 +120,11 @@ EuiDataGridHeaderCellWrapper.propTypes = {
|
|
|
119
120
|
children: _propTypes.default.oneOfType([_propTypes.default.node.isRequired, _propTypes.default.func.isRequired]).isRequired,
|
|
120
121
|
id: _propTypes.default.string.isRequired,
|
|
121
122
|
index: _propTypes.default.number.isRequired,
|
|
122
|
-
|
|
123
|
+
isLastColumn: _propTypes.default.bool.isRequired,
|
|
123
124
|
width: _propTypes.default.oneOfType([_propTypes.default.number.isRequired, _propTypes.default.oneOf([null])]),
|
|
124
125
|
className: _propTypes.default.string,
|
|
125
126
|
"aria-label": _propTypes.default.any,
|
|
126
|
-
|
|
127
|
-
|
|
127
|
+
hasColumnActions: _propTypes.default.bool,
|
|
128
|
+
isDragging: _propTypes.default.bool,
|
|
129
|
+
onKeyDown: _propTypes.default.any
|
|
128
130
|
};
|
|
@@ -25,8 +25,7 @@ var euiDataGridHeaderCellWrapperStyles = exports.euiDataGridHeaderCellWrapperSty
|
|
|
25
25
|
hoverStyles = _euiDataGridCellOutli.hoverStyles;
|
|
26
26
|
var _euiDataGridCellOutli2 = (0, _data_grid_cell.euiDataGridCellOutlineSelectors)(),
|
|
27
27
|
outlineSelectors = _euiDataGridCellOutli2.header;
|
|
28
|
-
var _sharedFlexCss = /*#__PURE__*/(0, _react.css)("display:flex;align-items:center;gap:", euiTheme.size.xxs, ";");
|
|
29
28
|
return {
|
|
30
|
-
euiDataGridHeaderCell: /*#__PURE__*/(0, _react.css)("position:relative;
|
|
29
|
+
euiDataGridHeaderCell: /*#__PURE__*/(0, _react.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;", (0, _global_styling.logicalCSS)('width', '100%'), ";};label:euiDataGridHeaderCell;")
|
|
31
30
|
};
|
|
32
31
|
};
|
|
@@ -12,11 +12,12 @@ var _classnames = _interopRequireDefault(require("classnames"));
|
|
|
12
12
|
var _react = _interopRequireWildcard(require("react"));
|
|
13
13
|
var _services = require("../../../../services");
|
|
14
14
|
var _data_grid_types = require("../../data_grid_types");
|
|
15
|
+
var _draggable_columns = require("./draggable_columns");
|
|
15
16
|
var _data_grid_control_header_cell = require("./data_grid_control_header_cell");
|
|
16
17
|
var _data_grid_header_cell = require("./data_grid_header_cell");
|
|
17
18
|
var _data_grid_header_row = require("./data_grid_header_row.styles");
|
|
18
19
|
var _react2 = require("@emotion/react");
|
|
19
|
-
var _excluded = ["className", "data-test-subj", "leadingControlColumns", "trailingControlColumns", "columns", "columnWidths", "defaultColumnWidth", "setColumnWidth", "visibleColCount", "setVisibleColumns", "switchColumnPos", "sorting", "schema", "schemaDetectors", "gridStyles"];
|
|
20
|
+
var _excluded = ["className", "data-test-subj", "leadingControlColumns", "trailingControlColumns", "columns", "columnWidths", "defaultColumnWidth", "setColumnWidth", "visibleColCount", "setVisibleColumns", "switchColumnPos", "sorting", "schema", "schemaDetectors", "gridStyles", "canDragAndDropColumns"];
|
|
20
21
|
/*
|
|
21
22
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
22
23
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
@@ -27,6 +28,7 @@ var _excluded = ["className", "data-test-subj", "leadingControlColumns", "traili
|
|
|
27
28
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
28
29
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
29
30
|
var EuiDataGridHeaderRow = exports.EuiDataGridHeaderRow = /*#__PURE__*/(0, _react.memo)( /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
31
|
+
var _leadingControlColumn;
|
|
30
32
|
var className = props.className,
|
|
31
33
|
_dataTestSubj = props['data-test-subj'],
|
|
32
34
|
_props$leadingControl = props.leadingControlColumns,
|
|
@@ -44,11 +46,15 @@ var EuiDataGridHeaderRow = exports.EuiDataGridHeaderRow = /*#__PURE__*/(0, _reac
|
|
|
44
46
|
schema = props.schema,
|
|
45
47
|
schemaDetectors = props.schemaDetectors,
|
|
46
48
|
gridStyles = props.gridStyles,
|
|
49
|
+
canDragAndDropColumns = props.canDragAndDropColumns,
|
|
47
50
|
rest = (0, _objectWithoutProperties2.default)(props, _excluded);
|
|
48
51
|
var styles = (0, _services.useEuiMemoizedStyles)(_data_grid_header_row.euiDataGridHeaderStyles);
|
|
49
52
|
var cssStyles = [styles.euiDataGridHeader, styles[gridStyles.header]];
|
|
50
53
|
var classes = (0, _classnames.default)('euiDataGridHeader', className);
|
|
51
54
|
var dataTestSubj = (0, _classnames.default)('dataGridHeader', _dataTestSubj);
|
|
55
|
+
var isLastColumn = (0, _react.useCallback)(function (index) {
|
|
56
|
+
return index === visibleColCount - 1;
|
|
57
|
+
}, [visibleColCount]);
|
|
52
58
|
return (0, _react2.jsx)("div", (0, _extends2.default)({
|
|
53
59
|
role: "row",
|
|
54
60
|
ref: ref,
|
|
@@ -59,30 +65,39 @@ var EuiDataGridHeaderRow = exports.EuiDataGridHeaderRow = /*#__PURE__*/(0, _reac
|
|
|
59
65
|
return (0, _react2.jsx)(_data_grid_control_header_cell.EuiDataGridControlHeaderCell, {
|
|
60
66
|
key: controlColumn.id,
|
|
61
67
|
index: index,
|
|
62
|
-
|
|
68
|
+
isLastColumn: isLastColumn(index),
|
|
63
69
|
controlColumn: controlColumn
|
|
64
70
|
});
|
|
65
|
-
}),
|
|
71
|
+
}), (0, _react2.jsx)(_draggable_columns.ConditionalDroppableColumns, {
|
|
72
|
+
canDragAndDropColumns: !!canDragAndDropColumns,
|
|
73
|
+
columns: columns,
|
|
74
|
+
switchColumnPos: switchColumnPos,
|
|
75
|
+
indexOffset: (_leadingControlColumn = leadingControlColumns === null || leadingControlColumns === void 0 ? void 0 : leadingControlColumns.length) !== null && _leadingControlColumn !== void 0 ? _leadingControlColumn : 0
|
|
76
|
+
}, columns.map(function (column, index) {
|
|
77
|
+
var visibleIndex = index + leadingControlColumns.length;
|
|
66
78
|
return (0, _react2.jsx)(_data_grid_header_cell.EuiDataGridHeaderCell, {
|
|
67
79
|
key: column.id,
|
|
68
|
-
index:
|
|
80
|
+
index: visibleIndex,
|
|
81
|
+
isLastColumn: isLastColumn(visibleIndex),
|
|
69
82
|
column: column,
|
|
70
83
|
columns: columns,
|
|
71
84
|
columnWidths: columnWidths,
|
|
72
85
|
defaultColumnWidth: defaultColumnWidth,
|
|
73
86
|
setColumnWidth: setColumnWidth,
|
|
74
|
-
visibleColCount: visibleColCount,
|
|
75
87
|
setVisibleColumns: setVisibleColumns,
|
|
76
88
|
switchColumnPos: switchColumnPos,
|
|
77
89
|
sorting: sorting,
|
|
78
90
|
schema: schema,
|
|
79
|
-
schemaDetectors: schemaDetectors
|
|
91
|
+
schemaDetectors: schemaDetectors,
|
|
92
|
+
canDragAndDropColumns: canDragAndDropColumns,
|
|
93
|
+
gridStyles: gridStyles
|
|
80
94
|
});
|
|
81
|
-
}), trailingControlColumns.map(function (controlColumn, index) {
|
|
95
|
+
})), trailingControlColumns.map(function (controlColumn, index) {
|
|
96
|
+
var visibleIndex = index + leadingControlColumns.length + columns.length;
|
|
82
97
|
return (0, _react2.jsx)(_data_grid_control_header_cell.EuiDataGridControlHeaderCell, {
|
|
83
98
|
key: controlColumn.id,
|
|
84
|
-
index:
|
|
85
|
-
|
|
99
|
+
index: visibleIndex,
|
|
100
|
+
isLastColumn: isLastColumn(visibleIndex),
|
|
86
101
|
controlColumn: controlColumn
|
|
87
102
|
});
|
|
88
103
|
}));
|