@elastic/eui 92.0.0 → 92.1.1
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_theme_dark.css +3 -18
- package/dist/eui_theme_dark.min.css +1 -1
- package/dist/eui_theme_light.css +3 -18
- package/dist/eui_theme_light.min.css +1 -1
- package/es/components/aspect_ratio/aspect_ratio.js +1 -1
- package/es/components/collapsible_nav_beta/collapsible_nav_body_footer.js +7 -3
- package/es/components/collapsible_nav_beta/collapsible_nav_body_footer.styles.js +4 -4
- package/es/components/datagrid/body/{data_grid_cell.js → cell/data_grid_cell.js} +111 -244
- package/es/components/datagrid/body/{data_grid_cell_actions.js → cell/data_grid_cell_actions.js} +5 -5
- package/es/components/datagrid/body/{data_grid_cell_popover.js → cell/data_grid_cell_popover.js} +4 -4
- package/es/components/datagrid/body/{data_grid_cell_wrapper.js → cell/data_grid_cell_wrapper.js} +1 -1
- package/es/components/datagrid/body/cell/focus_utils.js +166 -0
- package/es/components/datagrid/body/cell/index.js +11 -0
- package/es/components/datagrid/body/data_grid_body.js +0 -2
- package/es/components/datagrid/body/data_grid_body_custom.js +1 -7
- package/es/components/datagrid/body/data_grid_body_virtualized.js +1 -7
- package/es/components/datagrid/body/footer/data_grid_footer_row.js +1 -2
- package/es/components/datagrid/body/header/data_grid_control_header_cell.js +3 -6
- package/es/components/datagrid/body/header/data_grid_header_cell.js +27 -12
- package/es/components/datagrid/body/header/data_grid_header_cell_wrapper.js +45 -116
- package/es/components/datagrid/body/header/data_grid_header_row.js +5 -10
- package/es/components/datagrid/body/header/use_data_grid_header.js +3 -14
- package/es/components/datagrid/data_grid.js +2 -12
- package/es/components/datagrid/utils/focus.js +25 -54
- package/es/components/datagrid/utils/scrolling.js +1 -1
- package/es/components/flyout/flyout_resizable.js +10 -10
- package/es/components/flyout/flyout_resizable.styles.js +12 -6
- package/es/components/resizable_container/helpers.js +5 -6
- package/es/components/resizable_container/resizable_button.js +13 -4
- package/es/components/resizable_container/resizable_button.styles.js +18 -8
- package/es/components/resizable_container/resizable_container.js +28 -22
- package/es/components/steps/step_number.styles.js +6 -7
- package/es/components/tree_view/tree_view.js +9 -2
- package/eui.d.ts +130 -90
- package/i18ntokens.json +108 -72
- package/lib/components/aspect_ratio/aspect_ratio.js +1 -1
- package/lib/components/collapsible_nav_beta/collapsible_nav_body_footer.js +7 -3
- package/lib/components/collapsible_nav_beta/collapsible_nav_body_footer.styles.js +4 -4
- package/lib/components/datagrid/body/{data_grid_cell.js → cell/data_grid_cell.js} +111 -244
- package/lib/components/datagrid/body/{data_grid_cell_actions.js → cell/data_grid_cell_actions.js} +5 -5
- package/lib/components/datagrid/body/{data_grid_cell_popover.js → cell/data_grid_cell_popover.js} +4 -4
- package/lib/components/datagrid/body/{data_grid_cell_wrapper.js → cell/data_grid_cell_wrapper.js} +1 -1
- package/lib/components/datagrid/body/cell/focus_utils.js +174 -0
- package/lib/components/datagrid/body/cell/index.js +32 -0
- package/lib/components/datagrid/body/data_grid_body.js +0 -2
- package/lib/components/datagrid/body/data_grid_body_custom.js +2 -8
- package/lib/components/datagrid/body/data_grid_body_virtualized.js +2 -8
- package/lib/components/datagrid/body/footer/data_grid_footer_row.js +5 -6
- package/lib/components/datagrid/body/header/data_grid_control_header_cell.js +3 -6
- package/lib/components/datagrid/body/header/data_grid_header_cell.js +35 -20
- package/lib/components/datagrid/body/header/data_grid_header_cell_wrapper.js +47 -119
- package/lib/components/datagrid/body/header/data_grid_header_row.js +5 -10
- package/lib/components/datagrid/body/header/use_data_grid_header.js +10 -24
- package/lib/components/datagrid/data_grid.js +4 -14
- package/lib/components/datagrid/utils/focus.js +26 -56
- package/lib/components/datagrid/utils/scrolling.js +2 -2
- package/lib/components/flyout/flyout_resizable.js +10 -10
- package/lib/components/flyout/flyout_resizable.styles.js +12 -6
- package/lib/components/resizable_container/helpers.js +7 -7
- package/lib/components/resizable_container/resizable_button.js +13 -4
- package/lib/components/resizable_container/resizable_button.styles.js +18 -8
- package/lib/components/resizable_container/resizable_container.js +28 -22
- package/lib/components/steps/step_number.styles.js +6 -7
- package/lib/components/tree_view/tree_view.js +9 -2
- package/optimize/es/components/aspect_ratio/aspect_ratio.js +1 -1
- package/optimize/es/components/collapsible_nav_beta/collapsible_nav_body_footer.js +7 -3
- package/optimize/es/components/collapsible_nav_beta/collapsible_nav_body_footer.styles.js +4 -4
- package/optimize/es/components/datagrid/body/{data_grid_cell.js → cell/data_grid_cell.js} +111 -244
- package/optimize/es/components/datagrid/body/{data_grid_cell_actions.js → cell/data_grid_cell_actions.js} +5 -5
- package/optimize/es/components/datagrid/body/{data_grid_cell_popover.js → cell/data_grid_cell_popover.js} +4 -4
- package/optimize/es/components/datagrid/body/{data_grid_cell_wrapper.js → cell/data_grid_cell_wrapper.js} +1 -1
- package/optimize/es/components/datagrid/body/cell/focus_utils.js +153 -0
- package/optimize/es/components/datagrid/body/cell/index.js +11 -0
- package/optimize/es/components/datagrid/body/data_grid_body_custom.js +1 -5
- package/optimize/es/components/datagrid/body/data_grid_body_virtualized.js +1 -5
- package/optimize/es/components/datagrid/body/footer/data_grid_footer_row.js +1 -2
- package/optimize/es/components/datagrid/body/header/data_grid_control_header_cell.js +2 -4
- package/optimize/es/components/datagrid/body/header/data_grid_header_cell.js +25 -10
- package/optimize/es/components/datagrid/body/header/data_grid_header_cell_wrapper.js +41 -115
- package/optimize/es/components/datagrid/body/header/data_grid_header_row.js +4 -8
- package/optimize/es/components/datagrid/body/header/use_data_grid_header.js +3 -13
- package/optimize/es/components/datagrid/data_grid.js +2 -12
- package/optimize/es/components/datagrid/utils/focus.js +25 -54
- package/optimize/es/components/datagrid/utils/scrolling.js +1 -1
- package/optimize/es/components/flyout/flyout_resizable.js +10 -10
- package/optimize/es/components/flyout/flyout_resizable.styles.js +12 -6
- package/optimize/es/components/resizable_container/helpers.js +5 -6
- package/optimize/es/components/resizable_container/resizable_button.js +5 -2
- package/optimize/es/components/resizable_container/resizable_button.styles.js +18 -8
- package/optimize/es/components/resizable_container/resizable_container.js +28 -22
- package/optimize/es/components/steps/step_number.styles.js +6 -7
- package/optimize/es/components/tree_view/tree_view.js +9 -2
- package/optimize/lib/components/aspect_ratio/aspect_ratio.js +1 -1
- package/optimize/lib/components/collapsible_nav_beta/collapsible_nav_body_footer.js +7 -3
- package/optimize/lib/components/collapsible_nav_beta/collapsible_nav_body_footer.styles.js +4 -4
- package/optimize/lib/components/datagrid/body/{data_grid_cell.js → cell/data_grid_cell.js} +111 -244
- package/optimize/lib/components/datagrid/body/{data_grid_cell_actions.js → cell/data_grid_cell_actions.js} +5 -5
- package/optimize/lib/components/datagrid/body/{data_grid_cell_popover.js → cell/data_grid_cell_popover.js} +4 -4
- package/optimize/lib/components/datagrid/body/{data_grid_cell_wrapper.js → cell/data_grid_cell_wrapper.js} +1 -1
- package/optimize/lib/components/datagrid/body/cell/focus_utils.js +163 -0
- package/optimize/lib/components/datagrid/body/cell/index.js +32 -0
- package/optimize/lib/components/datagrid/body/data_grid_body_custom.js +2 -6
- package/optimize/lib/components/datagrid/body/data_grid_body_virtualized.js +2 -6
- package/optimize/lib/components/datagrid/body/footer/data_grid_footer_row.js +5 -6
- package/optimize/lib/components/datagrid/body/header/data_grid_control_header_cell.js +2 -4
- package/optimize/lib/components/datagrid/body/header/data_grid_header_cell.js +25 -10
- package/optimize/lib/components/datagrid/body/header/data_grid_header_cell_wrapper.js +41 -115
- package/optimize/lib/components/datagrid/body/header/data_grid_header_row.js +4 -8
- package/optimize/lib/components/datagrid/body/header/use_data_grid_header.js +4 -14
- package/optimize/lib/components/datagrid/data_grid.js +4 -14
- package/optimize/lib/components/datagrid/utils/focus.js +26 -56
- package/optimize/lib/components/datagrid/utils/scrolling.js +2 -2
- package/optimize/lib/components/flyout/flyout_resizable.js +10 -10
- package/optimize/lib/components/flyout/flyout_resizable.styles.js +12 -6
- package/optimize/lib/components/resizable_container/helpers.js +7 -7
- package/optimize/lib/components/resizable_container/resizable_button.js +5 -2
- package/optimize/lib/components/resizable_container/resizable_button.styles.js +18 -8
- package/optimize/lib/components/resizable_container/resizable_container.js +28 -22
- package/optimize/lib/components/steps/step_number.styles.js +6 -7
- package/optimize/lib/components/tree_view/tree_view.js +9 -2
- package/package.json +1 -1
- package/src/components/datagrid/body/header/_data_grid_header_row.scss +8 -7
- package/test-env/components/aspect_ratio/aspect_ratio.js +1 -1
- package/test-env/components/collapsible_nav_beta/collapsible_nav_body_footer.js +7 -3
- package/test-env/components/collapsible_nav_beta/collapsible_nav_body_footer.styles.js +4 -4
- package/test-env/components/datagrid/body/{data_grid_cell.js → cell/data_grid_cell.js} +111 -244
- package/test-env/components/datagrid/body/{data_grid_cell_actions.js → cell/data_grid_cell_actions.js} +5 -5
- package/test-env/components/datagrid/body/{data_grid_cell_popover.js → cell/data_grid_cell_popover.js} +4 -4
- package/test-env/components/datagrid/body/{data_grid_cell_wrapper.js → cell/data_grid_cell_wrapper.js} +1 -1
- package/test-env/components/datagrid/body/cell/focus_utils.js +172 -0
- package/test-env/components/datagrid/body/cell/index.js +32 -0
- package/test-env/components/datagrid/body/data_grid_body.js +0 -2
- package/test-env/components/datagrid/body/data_grid_body_custom.js +2 -8
- package/test-env/components/datagrid/body/data_grid_body_virtualized.js +2 -8
- package/test-env/components/datagrid/body/footer/data_grid_footer_row.js +5 -6
- package/test-env/components/datagrid/body/header/data_grid_control_header_cell.js +3 -6
- package/test-env/components/datagrid/body/header/data_grid_header_cell.js +25 -10
- package/test-env/components/datagrid/body/header/data_grid_header_cell_wrapper.js +44 -116
- package/test-env/components/datagrid/body/header/data_grid_header_row.js +5 -10
- package/test-env/components/datagrid/body/header/use_data_grid_header.js +4 -14
- package/test-env/components/datagrid/data_grid.js +4 -14
- package/test-env/components/datagrid/utils/focus.js +26 -56
- package/test-env/components/datagrid/utils/scrolling.js +2 -2
- package/test-env/components/flyout/flyout_resizable.js +10 -10
- package/test-env/components/flyout/flyout_resizable.styles.js +12 -6
- package/test-env/components/resizable_container/helpers.js +7 -7
- package/test-env/components/resizable_container/resizable_button.js +13 -4
- package/test-env/components/resizable_container/resizable_button.styles.js +18 -8
- package/test-env/components/resizable_container/resizable_container.js +28 -22
- package/test-env/components/steps/step_number.styles.js +6 -7
- package/test-env/components/tree_view/tree_view.js +9 -2
- package/es/components/datagrid/body/header/header_is_interactive.js +0 -58
- package/lib/components/datagrid/body/header/header_is_interactive.js +0 -63
- package/optimize/es/components/datagrid/body/header/header_is_interactive.js +0 -53
- package/optimize/lib/components/datagrid/body/header/header_is_interactive.js +0 -61
- package/test-env/components/datagrid/body/header/header_is_interactive.js +0 -61
|
@@ -8,11 +8,10 @@ exports.EuiDataGridHeaderCellWrapper = void 0;
|
|
|
8
8
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
9
9
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
10
10
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
-
var _tabbable = require("tabbable");
|
|
12
|
-
var _services = require("../../../../services");
|
|
13
11
|
var _focus = require("../../utils/focus");
|
|
12
|
+
var _focus_utils = require("../cell/focus_utils");
|
|
14
13
|
var _react2 = require("@emotion/react");
|
|
15
|
-
var _excluded = ["id", "index", "
|
|
14
|
+
var _excluded = ["id", "index", "width", "className", "children", "hasActionsPopover", "isActionsButtonFocused", "focusActionsButton"];
|
|
16
15
|
/*
|
|
17
16
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
18
17
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
@@ -20,6 +19,11 @@ var _excluded = ["id", "index", "headerIsInteractive", "width", "className", "ch
|
|
|
20
19
|
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
21
20
|
* Side Public License, v 1.
|
|
22
21
|
*/
|
|
22
|
+
/**
|
|
23
|
+
* This is a wrapper that handles repeated concerns between control &
|
|
24
|
+
* standard header cells. Most of its shared logic is around focus state/UX,
|
|
25
|
+
* but it also DRY's out certain class/data-test-subj/style attributes
|
|
26
|
+
*/
|
|
23
27
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
24
28
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
25
29
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -32,118 +36,59 @@ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefine
|
|
|
32
36
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
33
37
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
34
38
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
35
|
-
/**
|
|
36
|
-
* This is a wrapper that handles repeated concerns between control &
|
|
37
|
-
* standard header cells. Most of its shared logic is around focus state/UX,
|
|
38
|
-
* but it also DRY's out certain class/data-test-subj/style attributes
|
|
39
|
-
*/
|
|
40
39
|
var EuiDataGridHeaderCellWrapper = function EuiDataGridHeaderCellWrapper(_ref) {
|
|
41
40
|
var id = _ref.id,
|
|
42
41
|
index = _ref.index,
|
|
43
|
-
headerIsInteractive = _ref.headerIsInteractive,
|
|
44
42
|
width = _ref.width,
|
|
45
43
|
className = _ref.className,
|
|
46
44
|
children = _ref.children,
|
|
45
|
+
hasActionsPopover = _ref.hasActionsPopover,
|
|
46
|
+
isActionsButtonFocused = _ref.isActionsButtonFocused,
|
|
47
|
+
focusActionsButton = _ref.focusActionsButton,
|
|
47
48
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
48
49
|
var classes = (0, _classnames.default)('euiDataGridHeaderCell', className);
|
|
50
|
+
|
|
51
|
+
// Must be a state and not a ref to trigger a HandleInteractiveChildren rerender
|
|
52
|
+
var _useState = (0, _react.useState)(null),
|
|
53
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
54
|
+
headerEl = _useState2[0],
|
|
55
|
+
setHeaderEl = _useState2[1];
|
|
49
56
|
var _useContext = (0, _react.useContext)(_focus.DataGridFocusContext),
|
|
50
57
|
setFocusedCell = _useContext.setFocusedCell,
|
|
51
58
|
onFocusUpdate = _useContext.onFocusUpdate;
|
|
52
|
-
var
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
59
|
+
var updateCellFocusContext = (0, _react.useCallback)(function () {
|
|
60
|
+
setFocusedCell([index, -1]);
|
|
61
|
+
}, [index, setFocusedCell]);
|
|
62
|
+
var _useState3 = (0, _react.useState)(false),
|
|
63
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
64
|
+
isFocused = _useState4[0],
|
|
65
|
+
setIsFocused = _useState4[1];
|
|
56
66
|
(0, _react.useEffect)(function () {
|
|
57
67
|
onFocusUpdate([index, -1], function (isFocused) {
|
|
58
68
|
setIsFocused(isFocused);
|
|
59
69
|
});
|
|
60
70
|
}, [index, onFocusUpdate]);
|
|
61
|
-
var headerRef = (0, _react.useRef)(null);
|
|
62
|
-
var _useState3 = (0, _react.useState)(false),
|
|
63
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
64
|
-
isCellEntered = _useState4[0],
|
|
65
|
-
setIsCellEntered = _useState4[1];
|
|
66
|
-
(0, _react.useEffect)(function () {
|
|
67
|
-
var headerNode = headerRef.current;
|
|
68
|
-
if (isCellEntered) {
|
|
69
|
-
enableAndFocusInteractives(headerNode);
|
|
70
|
-
} else {
|
|
71
|
-
disableInteractives(headerNode);
|
|
72
|
-
}
|
|
73
|
-
}, [isCellEntered]);
|
|
74
71
|
(0, _react.useEffect)(function () {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
setIsCellEntered(true);
|
|
80
|
-
} else {
|
|
81
|
-
headerNode.focus();
|
|
72
|
+
if (isFocused && headerEl) {
|
|
73
|
+
// Only focus the cell if not already focused on something in the cell
|
|
74
|
+
if (!headerEl.contains(document.activeElement)) {
|
|
75
|
+
headerEl.focus();
|
|
82
76
|
}
|
|
83
|
-
} else {
|
|
84
|
-
setIsCellEntered(false);
|
|
85
77
|
}
|
|
78
|
+
}, [isFocused, headerEl]);
|
|
86
79
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
e.preventDefault();
|
|
95
|
-
return false;
|
|
96
|
-
} else {
|
|
97
|
-
// take the focus
|
|
98
|
-
if (isFocused === false) {
|
|
99
|
-
setFocusedCell([index, -1]);
|
|
100
|
-
} else {
|
|
101
|
-
// this cell already had the grid's focus, so re-enable and focus interactives
|
|
102
|
-
setIsCellEntered(true);
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
};
|
|
106
|
-
|
|
107
|
-
// focusout bubbles while blur does not, and this needs to react to the children losing focus
|
|
108
|
-
var onFocusOut = function onFocusOut() {
|
|
109
|
-
// wait for the next element to receive focus, then update interactives' state
|
|
110
|
-
requestAnimationFrame(function () {
|
|
111
|
-
if (!headerNode.contains(document.activeElement)) {
|
|
112
|
-
setIsCellEntered(false);
|
|
113
|
-
}
|
|
114
|
-
});
|
|
115
|
-
};
|
|
116
|
-
var onKeyUp = function onKeyUp(event) {
|
|
117
|
-
switch (event.key) {
|
|
118
|
-
case _services.keys.ENTER:
|
|
119
|
-
{
|
|
120
|
-
event.preventDefault();
|
|
121
|
-
setIsCellEntered(true);
|
|
122
|
-
break;
|
|
123
|
-
}
|
|
124
|
-
case _services.keys.ESCAPE:
|
|
125
|
-
{
|
|
126
|
-
event.preventDefault();
|
|
127
|
-
// move focus to cell
|
|
128
|
-
setIsCellEntered(false);
|
|
129
|
-
headerNode.focus();
|
|
130
|
-
break;
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
};
|
|
134
|
-
headerNode.addEventListener('focusin', onFocusIn);
|
|
135
|
-
headerNode.addEventListener('focusout', onFocusOut);
|
|
136
|
-
headerNode.addEventListener('keyup', onKeyUp);
|
|
137
|
-
return function () {
|
|
138
|
-
headerNode.removeEventListener('focusin', onFocusIn);
|
|
139
|
-
headerNode.removeEventListener('focusout', onFocusOut);
|
|
140
|
-
headerNode.removeEventListener('keyup', onKeyUp);
|
|
141
|
-
};
|
|
142
|
-
}, [headerIsInteractive, isFocused, index, setFocusedCell]);
|
|
80
|
+
// For cell headers with actions, auto-focus into the button instead of the cell wrapper div
|
|
81
|
+
// The button text is significantly more useful to screen readers (e.g. contains sort order & hints)
|
|
82
|
+
var onFocus = (0, _react.useCallback)(function (e) {
|
|
83
|
+
if (hasActionsPopover && e.target === headerEl) {
|
|
84
|
+
focusActionsButton === null || focusActionsButton === void 0 ? void 0 : focusActionsButton();
|
|
85
|
+
}
|
|
86
|
+
}, [hasActionsPopover, focusActionsButton, headerEl]);
|
|
143
87
|
return (0, _react2.jsx)("div", _extends({
|
|
144
88
|
role: "columnheader",
|
|
145
|
-
ref:
|
|
146
|
-
tabIndex: isFocused && !
|
|
89
|
+
ref: setHeaderEl,
|
|
90
|
+
tabIndex: isFocused && !isActionsButtonFocused ? 0 : -1,
|
|
91
|
+
onFocus: onFocus,
|
|
147
92
|
className: classes,
|
|
148
93
|
"data-test-subj": "dataGridHeaderCell-".concat(id),
|
|
149
94
|
"data-gridcell-column-id": id,
|
|
@@ -153,36 +98,19 @@ var EuiDataGridHeaderCellWrapper = function EuiDataGridHeaderCellWrapper(_ref) {
|
|
|
153
98
|
style: width != null ? {
|
|
154
99
|
width: "".concat(width, "px")
|
|
155
100
|
} : {}
|
|
156
|
-
}, rest),
|
|
101
|
+
}, rest), (0, _react2.jsx)(_focus_utils.HandleInteractiveChildren, {
|
|
102
|
+
cellEl: headerEl,
|
|
103
|
+
updateCellFocusContext: updateCellFocusContext,
|
|
104
|
+
renderFocusTrap: !hasActionsPopover
|
|
105
|
+
}, children));
|
|
157
106
|
};
|
|
158
|
-
|
|
159
|
-
/**
|
|
160
|
-
* Utility fns for managing child interactive tabIndex state
|
|
161
|
-
*/
|
|
162
107
|
exports.EuiDataGridHeaderCellWrapper = EuiDataGridHeaderCellWrapper;
|
|
163
108
|
EuiDataGridHeaderCellWrapper.propTypes = {
|
|
164
109
|
id: _propTypes.default.string.isRequired,
|
|
165
110
|
index: _propTypes.default.number.isRequired,
|
|
166
|
-
headerIsInteractive: _propTypes.default.bool.isRequired,
|
|
167
111
|
width: _propTypes.default.oneOfType([_propTypes.default.number.isRequired, _propTypes.default.oneOf([null])]),
|
|
168
|
-
className: _propTypes.default.string
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
if (tabbables.length > 1) {
|
|
173
|
-
console.warn("EuiDataGridHeaderCell expects at most 1 tabbable element, ".concat(tabbables.length, " found instead"));
|
|
174
|
-
}
|
|
175
|
-
tabbables.forEach(function (element) {
|
|
176
|
-
element.setAttribute('data-euigrid-tab-managed', 'true');
|
|
177
|
-
element.setAttribute('tabIndex', '-1');
|
|
178
|
-
});
|
|
179
|
-
};
|
|
180
|
-
var enableAndFocusInteractives = function enableAndFocusInteractives(headerNode) {
|
|
181
|
-
var interactiveElements = headerNode.querySelectorAll('[data-euigrid-tab-managed]');
|
|
182
|
-
interactiveElements.forEach(function (element, i) {
|
|
183
|
-
element.setAttribute('tabIndex', '0');
|
|
184
|
-
if (i === 0) {
|
|
185
|
-
element.focus();
|
|
186
|
-
}
|
|
187
|
-
});
|
|
112
|
+
className: _propTypes.default.string,
|
|
113
|
+
hasActionsPopover: _propTypes.default.bool,
|
|
114
|
+
isActionsButtonFocused: _propTypes.default.bool,
|
|
115
|
+
focusActionsButton: _propTypes.default.func
|
|
188
116
|
};
|
|
@@ -12,7 +12,7 @@ var _data_grid_control_header_cell = require("./data_grid_control_header_cell");
|
|
|
12
12
|
var _data_grid_header_cell = require("./data_grid_header_cell");
|
|
13
13
|
var _data_grid_types = require("../../data_grid_types");
|
|
14
14
|
var _react2 = require("@emotion/react");
|
|
15
|
-
var _excluded = ["leadingControlColumns", "trailingControlColumns", "columns", "schema", "schemaDetectors", "columnWidths", "defaultColumnWidth", "className", "setColumnWidth", "setVisibleColumns", "switchColumnPos", "
|
|
15
|
+
var _excluded = ["leadingControlColumns", "trailingControlColumns", "columns", "schema", "schemaDetectors", "columnWidths", "defaultColumnWidth", "className", "setColumnWidth", "setVisibleColumns", "switchColumnPos", "data-test-subj"];
|
|
16
16
|
/*
|
|
17
17
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
18
18
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
@@ -40,7 +40,6 @@ var EuiDataGridHeaderRow = /*#__PURE__*/(0, _react.forwardRef)(function (props,
|
|
|
40
40
|
setColumnWidth = props.setColumnWidth,
|
|
41
41
|
setVisibleColumns = props.setVisibleColumns,
|
|
42
42
|
switchColumnPos = props.switchColumnPos,
|
|
43
|
-
headerIsInteractive = props.headerIsInteractive,
|
|
44
43
|
_dataTestSubj = props['data-test-subj'],
|
|
45
44
|
rest = _objectWithoutProperties(props, _excluded);
|
|
46
45
|
var classes = (0, _classnames.default)('euiDataGridHeader', className);
|
|
@@ -54,8 +53,7 @@ var EuiDataGridHeaderRow = /*#__PURE__*/(0, _react.forwardRef)(function (props,
|
|
|
54
53
|
return (0, _react2.jsx)(_data_grid_control_header_cell.EuiDataGridControlHeaderCell, {
|
|
55
54
|
key: controlColumn.id,
|
|
56
55
|
index: index,
|
|
57
|
-
controlColumn: controlColumn
|
|
58
|
-
headerIsInteractive: headerIsInteractive
|
|
56
|
+
controlColumn: controlColumn
|
|
59
57
|
});
|
|
60
58
|
}), columns.map(function (column, index) {
|
|
61
59
|
return (0, _react2.jsx)(_data_grid_header_cell.EuiDataGridHeaderCell, {
|
|
@@ -69,15 +67,13 @@ var EuiDataGridHeaderRow = /*#__PURE__*/(0, _react.forwardRef)(function (props,
|
|
|
69
67
|
setColumnWidth: setColumnWidth,
|
|
70
68
|
setVisibleColumns: setVisibleColumns,
|
|
71
69
|
switchColumnPos: switchColumnPos,
|
|
72
|
-
defaultColumnWidth: defaultColumnWidth
|
|
73
|
-
headerIsInteractive: headerIsInteractive
|
|
70
|
+
defaultColumnWidth: defaultColumnWidth
|
|
74
71
|
});
|
|
75
72
|
}), trailingControlColumns.map(function (controlColumn, index) {
|
|
76
73
|
return (0, _react2.jsx)(_data_grid_control_header_cell.EuiDataGridControlHeaderCell, {
|
|
77
74
|
key: controlColumn.id,
|
|
78
75
|
index: index + leadingControlColumns.length + columns.length,
|
|
79
|
-
controlColumn: controlColumn
|
|
80
|
-
headerIsInteractive: headerIsInteractive
|
|
76
|
+
controlColumn: controlColumn
|
|
81
77
|
});
|
|
82
78
|
}));
|
|
83
79
|
});
|
|
@@ -617,7 +613,6 @@ EuiDataGridHeaderRow.propTypes = {
|
|
|
617
613
|
defaultColumnWidth: _propTypes.default.oneOfType([_propTypes.default.number.isRequired, _propTypes.default.oneOf([null])]),
|
|
618
614
|
setColumnWidth: _propTypes.default.func.isRequired,
|
|
619
615
|
setVisibleColumns: _propTypes.default.func.isRequired,
|
|
620
|
-
switchColumnPos: _propTypes.default.func.isRequired
|
|
621
|
-
headerIsInteractive: _propTypes.default.bool.isRequired
|
|
616
|
+
switchColumnPos: _propTypes.default.func.isRequired
|
|
622
617
|
};
|
|
623
618
|
EuiDataGridHeaderRow.displayName = 'EuiDataGridHeaderRow';
|
|
@@ -6,19 +6,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.useDataGridHeader = void 0;
|
|
8
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
-
var _mutation_observer = require("../../../observer/mutation_observer");
|
|
10
9
|
var _resize_observer = require("../../../observer/resize_observer");
|
|
11
|
-
var _focus = require("../../utils/focus");
|
|
12
10
|
var _data_grid_header_row = require("./data_grid_header_row");
|
|
13
11
|
var _react2 = require("@emotion/react");
|
|
14
|
-
var _excluded = ["handleHeaderMutation"];
|
|
15
|
-
/*
|
|
16
|
-
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
17
|
-
* or more contributor license agreements. Licensed under the Elastic License
|
|
18
|
-
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
19
|
-
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
20
|
-
* Side Public License, v 1.
|
|
21
|
-
*/
|
|
22
12
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
23
13
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
24
14
|
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); }
|
|
@@ -27,23 +17,20 @@ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructur
|
|
|
27
17
|
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); }
|
|
28
18
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
29
19
|
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; } }
|
|
30
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
20
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } /*
|
|
21
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
22
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
23
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
24
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
25
|
+
* Side Public License, v 1.
|
|
26
|
+
*/ /**
|
|
27
|
+
* DRY out setting up the grid header and its refs & observers
|
|
28
|
+
*/
|
|
29
|
+
var useDataGridHeader = function useDataGridHeader(props) {
|
|
39
30
|
var _useState = (0, _react.useState)(null),
|
|
40
31
|
_useState2 = _slicedToArray(_useState, 2),
|
|
41
32
|
headerRowRef = _useState2[0],
|
|
42
33
|
setHeaderRowRef = _useState2[1];
|
|
43
|
-
(0, _mutation_observer.useMutationObserver)(headerRowRef, handleHeaderMutation, {
|
|
44
|
-
subtree: true,
|
|
45
|
-
childList: true
|
|
46
|
-
});
|
|
47
34
|
var _useResizeObserver = (0, _resize_observer.useResizeObserver)(headerRowRef, 'height'),
|
|
48
35
|
headerRowHeight = _useResizeObserver.height;
|
|
49
36
|
var headerRow = (0, _react.useMemo)(function () {
|
|
@@ -52,7 +39,6 @@ var useDataGridHeader = function useDataGridHeader(_ref) {
|
|
|
52
39
|
}, props));
|
|
53
40
|
}, Object.values(props)); // eslint-disable-line react-hooks/exhaustive-deps
|
|
54
41
|
|
|
55
|
-
(0, _focus.useHeaderFocusWorkaround)(props.headerIsInteractive);
|
|
56
42
|
return {
|
|
57
43
|
headerRow: headerRow,
|
|
58
44
|
headerRowHeight: headerRowHeight
|
|
@@ -18,8 +18,7 @@ var _controls = require("./controls");
|
|
|
18
18
|
var _sorting = require("./utils/sorting");
|
|
19
19
|
var _focus = require("./utils/focus");
|
|
20
20
|
var _in_memory = require("./utils/in_memory");
|
|
21
|
-
var
|
|
22
|
-
var _data_grid_cell_popover = require("./body/data_grid_cell_popover");
|
|
21
|
+
var _cell = require("./body/cell");
|
|
23
22
|
var _row_count = require("./utils/row_count");
|
|
24
23
|
var _data_grid_pagination = require("./utils/data_grid_pagination");
|
|
25
24
|
var _data_grid_schema = require("./utils/data_grid_schema");
|
|
@@ -218,20 +217,14 @@ var EuiDataGrid = /*#__PURE__*/(0, _react.memo)( /*#__PURE__*/(0, _react.forward
|
|
|
218
217
|
/**
|
|
219
218
|
* Focus
|
|
220
219
|
*/
|
|
221
|
-
var
|
|
222
|
-
headerIsInteractive = _useHeaderIsInteracti.headerIsInteractive,
|
|
223
|
-
handleHeaderMutation = _useHeaderIsInteracti.handleHeaderMutation;
|
|
224
|
-
var _useFocus = (0, _focus.useFocus)({
|
|
225
|
-
headerIsInteractive: headerIsInteractive,
|
|
226
|
-
gridItemsRendered: gridItemsRendered
|
|
227
|
-
}),
|
|
220
|
+
var _useFocus = (0, _focus.useFocus)(),
|
|
228
221
|
wrappingDivFocusProps = _useFocus.focusProps,
|
|
229
222
|
focusContext = _objectWithoutProperties(_useFocus, _excluded2);
|
|
230
223
|
|
|
231
224
|
/**
|
|
232
225
|
* Cell popover
|
|
233
226
|
*/
|
|
234
|
-
var _useCellPopover = (0,
|
|
227
|
+
var _useCellPopover = (0, _cell.useCellPopover)(),
|
|
235
228
|
cellPopoverContext = _useCellPopover.cellPopoverContext,
|
|
236
229
|
cellPopover = _useCellPopover.cellPopover;
|
|
237
230
|
|
|
@@ -305,7 +298,7 @@ var EuiDataGrid = /*#__PURE__*/(0, _react.memo)( /*#__PURE__*/(0, _react.forward
|
|
|
305
298
|
}
|
|
306
299
|
return (0, _react2.jsx)(_focus.DataGridFocusContext.Provider, {
|
|
307
300
|
value: focusContext
|
|
308
|
-
}, (0, _react2.jsx)(
|
|
301
|
+
}, (0, _react2.jsx)(_cell.DataGridCellPopoverContext.Provider, {
|
|
309
302
|
value: cellPopoverContext
|
|
310
303
|
}, (0, _react2.jsx)(_sorting.DataGridSortingContext.Provider, {
|
|
311
304
|
value: sortingContext
|
|
@@ -352,7 +345,6 @@ var EuiDataGrid = /*#__PURE__*/(0, _react.memo)( /*#__PURE__*/(0, _react.forward
|
|
|
352
345
|
rowCount: rowCount,
|
|
353
346
|
pagination: pagination,
|
|
354
347
|
hasFooter: !!renderFooterCellValue,
|
|
355
|
-
headerIsInteractive: headerIsInteractive,
|
|
356
348
|
focusContext: focusContext
|
|
357
349
|
}),
|
|
358
350
|
"data-test-subj": "euiDataGridBody",
|
|
@@ -369,8 +361,6 @@ var EuiDataGrid = /*#__PURE__*/(0, _react.memo)( /*#__PURE__*/(0, _react.forward
|
|
|
369
361
|
setVisibleColumns: setVisibleColumns,
|
|
370
362
|
switchColumnPos: switchColumnPos,
|
|
371
363
|
onColumnResize: onColumnResize,
|
|
372
|
-
headerIsInteractive: headerIsInteractive,
|
|
373
|
-
handleHeaderMutation: handleHeaderMutation,
|
|
374
364
|
schemaDetectors: allSchemaDetectors,
|
|
375
365
|
pagination: pagination,
|
|
376
366
|
renderCellValue: renderCellValue,
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.useFocus = exports.preventTabbing = exports.notifyCellOfFocusState = exports.getParentCellContent = exports.createKeyDownHandler = exports.DataGridFocusContext = void 0;
|
|
7
7
|
var _react = require("react");
|
|
8
8
|
var _tabbable = require("tabbable");
|
|
9
9
|
var _services = require("../../../services");
|
|
@@ -32,9 +32,7 @@ exports.DataGridFocusContext = DataGridFocusContext;
|
|
|
32
32
|
/**
|
|
33
33
|
* Main focus context and overarching focus state management
|
|
34
34
|
*/
|
|
35
|
-
var useFocus = function useFocus(
|
|
36
|
-
var headerIsInteractive = _ref.headerIsInteractive,
|
|
37
|
-
gridItemsRendered = _ref.gridItemsRendered;
|
|
35
|
+
var useFocus = function useFocus() {
|
|
38
36
|
// Maintain a map of focus cell state callbacks
|
|
39
37
|
var cellsUpdateFocus = (0, _react.useRef)(new Map());
|
|
40
38
|
var onFocusUpdate = (0, _react.useCallback)(function (cell, updateFocus) {
|
|
@@ -55,14 +53,17 @@ var useFocus = function useFocus(_ref) {
|
|
|
55
53
|
focusedCell = _useState4[0],
|
|
56
54
|
_setFocusedCell = _useState4[1];
|
|
57
55
|
var setFocusedCell = (0, _react.useCallback)(function (nextFocusedCell) {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
56
|
+
_setFocusedCell(function (prevFocusedCell) {
|
|
57
|
+
// If the x/y coordinates remained the same, don't update. This keeps the focusedCell
|
|
58
|
+
// reference stable, and allows it to be used in places that need reference equality.
|
|
59
|
+
if (nextFocusedCell[0] === (prevFocusedCell === null || prevFocusedCell === void 0 ? void 0 : prevFocusedCell[0]) && nextFocusedCell[1] === (prevFocusedCell === null || prevFocusedCell === void 0 ? void 0 : prevFocusedCell[1])) {
|
|
60
|
+
return prevFocusedCell;
|
|
61
|
+
} else {
|
|
62
|
+
setIsFocusedCellInView(true); // scrolling.ts ensures focused cells are fully in view
|
|
63
|
+
return nextFocusedCell;
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
}, []);
|
|
66
67
|
var previousCell = (0, _react.useRef)(undefined);
|
|
67
68
|
(0, _react.useEffect)(function () {
|
|
68
69
|
if (previousCell.current) {
|
|
@@ -74,19 +75,8 @@ var useFocus = function useFocus(_ref) {
|
|
|
74
75
|
}
|
|
75
76
|
}, [cellsUpdateFocus, focusedCell]);
|
|
76
77
|
var focusFirstVisibleInteractiveCell = (0, _react.useCallback)(function () {
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
setFocusedCell([0, -1]);
|
|
80
|
-
} else if (gridItemsRendered.current) {
|
|
81
|
-
var _gridItemsRendered$cu = gridItemsRendered.current,
|
|
82
|
-
visibleColumnStartIndex = _gridItemsRendered$cu.visibleColumnStartIndex,
|
|
83
|
-
visibleRowStartIndex = _gridItemsRendered$cu.visibleRowStartIndex;
|
|
84
|
-
setFocusedCell([visibleColumnStartIndex, visibleRowStartIndex]);
|
|
85
|
-
} else {
|
|
86
|
-
// If the header is non-interactive and there are no rendered cells,
|
|
87
|
-
// there's nothing to do - we might as well leave focus on the grid body wrapper
|
|
88
|
-
}
|
|
89
|
-
}, [setFocusedCell, headerIsInteractive, gridItemsRendered]);
|
|
78
|
+
setFocusedCell([0, -1]);
|
|
79
|
+
}, [setFocusedCell]);
|
|
90
80
|
var focusProps = (0, _react.useMemo)(function () {
|
|
91
81
|
return isFocusedCellInView ? {
|
|
92
82
|
// FireFox allows tabbing to a div that is scrollable, while Chrome does not
|
|
@@ -129,16 +119,15 @@ var notifyCellOfFocusState = function notifyCellOfFocusState(cellsUpdateFocus, c
|
|
|
129
119
|
* Keydown handler for connecting focus state with keyboard navigation
|
|
130
120
|
*/
|
|
131
121
|
exports.notifyCellOfFocusState = notifyCellOfFocusState;
|
|
132
|
-
var createKeyDownHandler = function createKeyDownHandler(
|
|
133
|
-
var gridElement =
|
|
134
|
-
visibleColCount =
|
|
135
|
-
visibleRowCount =
|
|
136
|
-
visibleRowStartIndex =
|
|
137
|
-
rowCount =
|
|
138
|
-
pagination =
|
|
139
|
-
hasFooter =
|
|
140
|
-
|
|
141
|
-
focusContext = _ref2.focusContext;
|
|
122
|
+
var createKeyDownHandler = function createKeyDownHandler(_ref) {
|
|
123
|
+
var gridElement = _ref.gridElement,
|
|
124
|
+
visibleColCount = _ref.visibleColCount,
|
|
125
|
+
visibleRowCount = _ref.visibleRowCount,
|
|
126
|
+
visibleRowStartIndex = _ref.visibleRowStartIndex,
|
|
127
|
+
rowCount = _ref.rowCount,
|
|
128
|
+
pagination = _ref.pagination,
|
|
129
|
+
hasFooter = _ref.hasFooter,
|
|
130
|
+
focusContext = _ref.focusContext;
|
|
142
131
|
return function (event) {
|
|
143
132
|
var focusedCell = focusContext.focusedCell,
|
|
144
133
|
setFocusedCell = focusContext.setFocusedCell;
|
|
@@ -172,8 +161,7 @@ var createKeyDownHandler = function createKeyDownHandler(_ref2) {
|
|
|
172
161
|
}
|
|
173
162
|
} else if (key === _services.keys.ARROW_UP) {
|
|
174
163
|
event.preventDefault();
|
|
175
|
-
|
|
176
|
-
if (y > minimumIndex) {
|
|
164
|
+
if (y > -1) {
|
|
177
165
|
setFocusedCell([x, y - 1]);
|
|
178
166
|
}
|
|
179
167
|
} else if (key === _services.keys.ARROW_RIGHT) {
|
|
@@ -263,22 +251,4 @@ var getParentCellContent = function getParentCellContent(_element) {
|
|
|
263
251
|
}
|
|
264
252
|
return element;
|
|
265
253
|
};
|
|
266
|
-
|
|
267
|
-
/**
|
|
268
|
-
* Focus fixes & workarounds
|
|
269
|
-
*/
|
|
270
|
-
|
|
271
|
-
// If the focus is on the header, and the header is no longer interactive,
|
|
272
|
-
// move the focus down to the first row
|
|
273
|
-
exports.getParentCellContent = getParentCellContent;
|
|
274
|
-
var useHeaderFocusWorkaround = function useHeaderFocusWorkaround(headerIsInteractive) {
|
|
275
|
-
var _useContext = (0, _react.useContext)(DataGridFocusContext),
|
|
276
|
-
focusedCell = _useContext.focusedCell,
|
|
277
|
-
setFocusedCell = _useContext.setFocusedCell;
|
|
278
|
-
(0, _react.useEffect)(function () {
|
|
279
|
-
if (!headerIsInteractive && focusedCell && focusedCell[1] === -1) {
|
|
280
|
-
setFocusedCell([focusedCell[0], 0]);
|
|
281
|
-
}
|
|
282
|
-
}, [headerIsInteractive, focusedCell, setFocusedCell]);
|
|
283
|
-
};
|
|
284
|
-
exports.useHeaderFocusWorkaround = useHeaderFocusWorkaround;
|
|
254
|
+
exports.getParentCellContent = getParentCellContent;
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.useScrollCellIntoView = exports.useScrollBars = exports.useScroll = void 0;
|
|
8
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
-
var
|
|
9
|
+
var _cell = require("../body/cell");
|
|
10
10
|
var _focus = require("./focus");
|
|
11
11
|
var _react2 = require("@emotion/react");
|
|
12
12
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
@@ -39,7 +39,7 @@ var useScroll = function useScroll(args) {
|
|
|
39
39
|
});
|
|
40
40
|
}
|
|
41
41
|
}, [focusedCell, scrollCellIntoView]);
|
|
42
|
-
var _useContext2 = (0, _react.useContext)(
|
|
42
|
+
var _useContext2 = (0, _react.useContext)(_cell.DataGridCellPopoverContext),
|
|
43
43
|
popoverIsOpen = _useContext2.popoverIsOpen,
|
|
44
44
|
cellLocation = _useContext2.cellLocation;
|
|
45
45
|
(0, _react.useEffect)(function () {
|
|
@@ -8,10 +8,11 @@ exports.EuiFlyoutResizable = void 0;
|
|
|
8
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
9
9
|
var _services = require("../../services");
|
|
10
10
|
var _resizable_container = require("../resizable_container");
|
|
11
|
+
var _helpers = require("../resizable_container/helpers");
|
|
11
12
|
var _flyout = require("./flyout");
|
|
12
13
|
var _flyout_resizable = require("./flyout_resizable.styles");
|
|
13
14
|
var _react2 = require("@emotion/react");
|
|
14
|
-
var _excluded = ["size", "maxWidth", "minWidth", "side", "children"];
|
|
15
|
+
var _excluded = ["size", "maxWidth", "minWidth", "side", "type", "children"];
|
|
15
16
|
/*
|
|
16
17
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
17
18
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
@@ -37,11 +38,13 @@ var EuiFlyoutResizable = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref
|
|
|
37
38
|
minWidth = _ref$minWidth === void 0 ? 200 : _ref$minWidth,
|
|
38
39
|
_ref$side = _ref.side,
|
|
39
40
|
side = _ref$side === void 0 ? 'right' : _ref$side,
|
|
41
|
+
_ref$type = _ref.type,
|
|
42
|
+
type = _ref$type === void 0 ? 'overlay' : _ref$type,
|
|
40
43
|
children = _ref.children,
|
|
41
44
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
42
45
|
var euiTheme = (0, _services.useEuiTheme)();
|
|
43
46
|
var styles = (0, _flyout_resizable.euiFlyoutResizableButtonStyles)(euiTheme);
|
|
44
|
-
var cssStyles = [styles.euiFlyoutResizableButton, styles[side]];
|
|
47
|
+
var cssStyles = [styles.euiFlyoutResizableButton, styles[type][side]];
|
|
45
48
|
var getFlyoutMinMaxWidth = (0, _react.useCallback)(function (width) {
|
|
46
49
|
return Math.min(Math.max(width, minWidth), maxWidth || Infinity, window.innerWidth - 20 // Leave some offset
|
|
47
50
|
);
|
|
@@ -75,7 +78,7 @@ var EuiFlyoutResizable = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref
|
|
|
75
78
|
return modifier;
|
|
76
79
|
}, [side, flyoutRef]);
|
|
77
80
|
var onMouseMove = (0, _react.useCallback)(function (e) {
|
|
78
|
-
var mouseOffset =
|
|
81
|
+
var mouseOffset = (0, _helpers.getPosition)(e, true) - initialMouseX.current;
|
|
79
82
|
var changedFlyoutWidth = initialWidth.current + mouseOffset * direction;
|
|
80
83
|
setFlyoutWidth(getFlyoutMinMaxWidth(changedFlyoutWidth));
|
|
81
84
|
}, [getFlyoutMinMaxWidth, direction]);
|
|
@@ -88,7 +91,7 @@ var EuiFlyoutResizable = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref
|
|
|
88
91
|
}, [onMouseMove]);
|
|
89
92
|
var onMouseDown = (0, _react.useCallback)(function (e) {
|
|
90
93
|
var _flyoutRef$offsetWidt;
|
|
91
|
-
initialMouseX.current =
|
|
94
|
+
initialMouseX.current = (0, _helpers.getPosition)(e, true);
|
|
92
95
|
initialWidth.current = (_flyoutRef$offsetWidt = flyoutRef === null || flyoutRef === void 0 ? void 0 : flyoutRef.offsetWidth) !== null && _flyoutRef$offsetWidt !== void 0 ? _flyoutRef$offsetWidt : 0;
|
|
93
96
|
|
|
94
97
|
// Window event listeners instead of React events are used
|
|
@@ -118,9 +121,11 @@ var EuiFlyoutResizable = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref
|
|
|
118
121
|
size: flyoutWidth || size,
|
|
119
122
|
maxWidth: maxWidth,
|
|
120
123
|
side: side,
|
|
124
|
+
type: type,
|
|
121
125
|
ref: setRefs
|
|
122
126
|
}), (0, _react2.jsx)(_resizable_container.EuiResizableButton, {
|
|
123
127
|
isHorizontal: true,
|
|
128
|
+
indicator: "border",
|
|
124
129
|
css: cssStyles,
|
|
125
130
|
onMouseDown: onMouseDown,
|
|
126
131
|
onTouchStart: onMouseDown,
|
|
@@ -128,9 +133,4 @@ var EuiFlyoutResizable = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref
|
|
|
128
133
|
}), children);
|
|
129
134
|
});
|
|
130
135
|
exports.EuiFlyoutResizable = EuiFlyoutResizable;
|
|
131
|
-
EuiFlyoutResizable.displayName = 'EuiFlyoutResizable';
|
|
132
|
-
var getMouseOrTouchX = function getMouseOrTouchX(e) {
|
|
133
|
-
// Some Typescript fooling is needed here
|
|
134
|
-
var x = e.targetTouches ? e.targetTouches[0].pageX : e.pageX;
|
|
135
|
-
return x;
|
|
136
|
-
};
|
|
136
|
+
EuiFlyoutResizable.displayName = 'EuiFlyoutResizable';
|