@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
|
@@ -12,11 +12,10 @@ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/h
|
|
|
12
12
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
13
13
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
14
14
|
var _react = _interopRequireWildcard(require("react"));
|
|
15
|
-
var _tabbable = require("tabbable");
|
|
16
|
-
var _services = require("../../../../services");
|
|
17
15
|
var _focus = require("../../utils/focus");
|
|
16
|
+
var _focus_utils = require("../cell/focus_utils");
|
|
18
17
|
var _react2 = require("@emotion/react");
|
|
19
|
-
var _excluded = ["id", "index", "
|
|
18
|
+
var _excluded = ["id", "index", "width", "className", "children", "hasActionsPopover", "isActionsButtonFocused", "focusActionsButton"];
|
|
20
19
|
/*
|
|
21
20
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
22
21
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
@@ -24,120 +23,66 @@ var _excluded = ["id", "index", "headerIsInteractive", "width", "className", "ch
|
|
|
24
23
|
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
25
24
|
* Side Public License, v 1.
|
|
26
25
|
*/
|
|
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); }
|
|
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; }
|
|
29
26
|
/**
|
|
30
27
|
* This is a wrapper that handles repeated concerns between control &
|
|
31
28
|
* standard header cells. Most of its shared logic is around focus state/UX,
|
|
32
29
|
* but it also DRY's out certain class/data-test-subj/style attributes
|
|
33
30
|
*/
|
|
31
|
+
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); }
|
|
32
|
+
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; }
|
|
34
33
|
var EuiDataGridHeaderCellWrapper = function EuiDataGridHeaderCellWrapper(_ref) {
|
|
35
34
|
var id = _ref.id,
|
|
36
35
|
index = _ref.index,
|
|
37
|
-
headerIsInteractive = _ref.headerIsInteractive,
|
|
38
36
|
width = _ref.width,
|
|
39
37
|
className = _ref.className,
|
|
40
38
|
children = _ref.children,
|
|
39
|
+
hasActionsPopover = _ref.hasActionsPopover,
|
|
40
|
+
isActionsButtonFocused = _ref.isActionsButtonFocused,
|
|
41
|
+
focusActionsButton = _ref.focusActionsButton,
|
|
41
42
|
rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
42
43
|
var classes = (0, _classnames.default)('euiDataGridHeaderCell', className);
|
|
44
|
+
|
|
45
|
+
// Must be a state and not a ref to trigger a HandleInteractiveChildren rerender
|
|
46
|
+
var _useState = (0, _react.useState)(null),
|
|
47
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
48
|
+
headerEl = _useState2[0],
|
|
49
|
+
setHeaderEl = _useState2[1];
|
|
43
50
|
var _useContext = (0, _react.useContext)(_focus.DataGridFocusContext),
|
|
44
51
|
setFocusedCell = _useContext.setFocusedCell,
|
|
45
52
|
onFocusUpdate = _useContext.onFocusUpdate;
|
|
46
|
-
var
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
53
|
+
var updateCellFocusContext = (0, _react.useCallback)(function () {
|
|
54
|
+
setFocusedCell([index, -1]);
|
|
55
|
+
}, [index, setFocusedCell]);
|
|
56
|
+
var _useState3 = (0, _react.useState)(false),
|
|
57
|
+
_useState4 = (0, _slicedToArray2.default)(_useState3, 2),
|
|
58
|
+
isFocused = _useState4[0],
|
|
59
|
+
setIsFocused = _useState4[1];
|
|
50
60
|
(0, _react.useEffect)(function () {
|
|
51
61
|
onFocusUpdate([index, -1], function (isFocused) {
|
|
52
62
|
setIsFocused(isFocused);
|
|
53
63
|
});
|
|
54
64
|
}, [index, onFocusUpdate]);
|
|
55
|
-
var headerRef = (0, _react.useRef)(null);
|
|
56
|
-
var _useState3 = (0, _react.useState)(false),
|
|
57
|
-
_useState4 = (0, _slicedToArray2.default)(_useState3, 2),
|
|
58
|
-
isCellEntered = _useState4[0],
|
|
59
|
-
setIsCellEntered = _useState4[1];
|
|
60
65
|
(0, _react.useEffect)(function () {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
disableInteractives(headerNode);
|
|
66
|
-
}
|
|
67
|
-
}, [isCellEntered]);
|
|
68
|
-
(0, _react.useEffect)(function () {
|
|
69
|
-
var headerNode = headerRef.current;
|
|
70
|
-
if (isFocused) {
|
|
71
|
-
var interactives = headerNode.querySelectorAll('[data-euigrid-tab-managed]');
|
|
72
|
-
if (interactives.length === 1) {
|
|
73
|
-
setIsCellEntered(true);
|
|
74
|
-
} else {
|
|
75
|
-
headerNode.focus();
|
|
66
|
+
if (isFocused && headerEl) {
|
|
67
|
+
// Only focus the cell if not already focused on something in the cell
|
|
68
|
+
if (!headerEl.contains(document.activeElement)) {
|
|
69
|
+
headerEl.focus();
|
|
76
70
|
}
|
|
77
|
-
} else {
|
|
78
|
-
setIsCellEntered(false);
|
|
79
71
|
}
|
|
72
|
+
}, [isFocused, headerEl]);
|
|
80
73
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
e.preventDefault();
|
|
89
|
-
return false;
|
|
90
|
-
} else {
|
|
91
|
-
// take the focus
|
|
92
|
-
if (isFocused === false) {
|
|
93
|
-
setFocusedCell([index, -1]);
|
|
94
|
-
} else {
|
|
95
|
-
// this cell already had the grid's focus, so re-enable and focus interactives
|
|
96
|
-
setIsCellEntered(true);
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
};
|
|
100
|
-
|
|
101
|
-
// focusout bubbles while blur does not, and this needs to react to the children losing focus
|
|
102
|
-
var onFocusOut = function onFocusOut() {
|
|
103
|
-
// wait for the next element to receive focus, then update interactives' state
|
|
104
|
-
requestAnimationFrame(function () {
|
|
105
|
-
if (!headerNode.contains(document.activeElement)) {
|
|
106
|
-
setIsCellEntered(false);
|
|
107
|
-
}
|
|
108
|
-
});
|
|
109
|
-
};
|
|
110
|
-
var onKeyUp = function onKeyUp(event) {
|
|
111
|
-
switch (event.key) {
|
|
112
|
-
case _services.keys.ENTER:
|
|
113
|
-
{
|
|
114
|
-
event.preventDefault();
|
|
115
|
-
setIsCellEntered(true);
|
|
116
|
-
break;
|
|
117
|
-
}
|
|
118
|
-
case _services.keys.ESCAPE:
|
|
119
|
-
{
|
|
120
|
-
event.preventDefault();
|
|
121
|
-
// move focus to cell
|
|
122
|
-
setIsCellEntered(false);
|
|
123
|
-
headerNode.focus();
|
|
124
|
-
break;
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
};
|
|
128
|
-
headerNode.addEventListener('focusin', onFocusIn);
|
|
129
|
-
headerNode.addEventListener('focusout', onFocusOut);
|
|
130
|
-
headerNode.addEventListener('keyup', onKeyUp);
|
|
131
|
-
return function () {
|
|
132
|
-
headerNode.removeEventListener('focusin', onFocusIn);
|
|
133
|
-
headerNode.removeEventListener('focusout', onFocusOut);
|
|
134
|
-
headerNode.removeEventListener('keyup', onKeyUp);
|
|
135
|
-
};
|
|
136
|
-
}, [headerIsInteractive, isFocused, index, setFocusedCell]);
|
|
74
|
+
// For cell headers with actions, auto-focus into the button instead of the cell wrapper div
|
|
75
|
+
// The button text is significantly more useful to screen readers (e.g. contains sort order & hints)
|
|
76
|
+
var onFocus = (0, _react.useCallback)(function (e) {
|
|
77
|
+
if (hasActionsPopover && e.target === headerEl) {
|
|
78
|
+
focusActionsButton === null || focusActionsButton === void 0 ? void 0 : focusActionsButton();
|
|
79
|
+
}
|
|
80
|
+
}, [hasActionsPopover, focusActionsButton, headerEl]);
|
|
137
81
|
return (0, _react2.jsx)("div", (0, _extends2.default)({
|
|
138
82
|
role: "columnheader",
|
|
139
|
-
ref:
|
|
140
|
-
tabIndex: isFocused && !
|
|
83
|
+
ref: setHeaderEl,
|
|
84
|
+
tabIndex: isFocused && !isActionsButtonFocused ? 0 : -1,
|
|
85
|
+
onFocus: onFocus,
|
|
141
86
|
className: classes,
|
|
142
87
|
"data-test-subj": "dataGridHeaderCell-".concat(id),
|
|
143
88
|
"data-gridcell-column-id": id,
|
|
@@ -147,36 +92,19 @@ var EuiDataGridHeaderCellWrapper = function EuiDataGridHeaderCellWrapper(_ref) {
|
|
|
147
92
|
style: width != null ? {
|
|
148
93
|
width: "".concat(width, "px")
|
|
149
94
|
} : {}
|
|
150
|
-
}, rest),
|
|
95
|
+
}, rest), (0, _react2.jsx)(_focus_utils.HandleInteractiveChildren, {
|
|
96
|
+
cellEl: headerEl,
|
|
97
|
+
updateCellFocusContext: updateCellFocusContext,
|
|
98
|
+
renderFocusTrap: !hasActionsPopover
|
|
99
|
+
}, children));
|
|
151
100
|
};
|
|
152
|
-
|
|
153
|
-
/**
|
|
154
|
-
* Utility fns for managing child interactive tabIndex state
|
|
155
|
-
*/
|
|
156
101
|
exports.EuiDataGridHeaderCellWrapper = EuiDataGridHeaderCellWrapper;
|
|
157
102
|
EuiDataGridHeaderCellWrapper.propTypes = {
|
|
158
103
|
id: _propTypes.default.string.isRequired,
|
|
159
104
|
index: _propTypes.default.number.isRequired,
|
|
160
|
-
headerIsInteractive: _propTypes.default.bool.isRequired,
|
|
161
105
|
width: _propTypes.default.oneOfType([_propTypes.default.number.isRequired, _propTypes.default.oneOf([null])]),
|
|
162
|
-
className: _propTypes.default.string
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
if (tabbables.length > 1) {
|
|
167
|
-
console.warn("EuiDataGridHeaderCell expects at most 1 tabbable element, ".concat(tabbables.length, " found instead"));
|
|
168
|
-
}
|
|
169
|
-
tabbables.forEach(function (element) {
|
|
170
|
-
element.setAttribute('data-euigrid-tab-managed', 'true');
|
|
171
|
-
element.setAttribute('tabIndex', '-1');
|
|
172
|
-
});
|
|
173
|
-
};
|
|
174
|
-
var enableAndFocusInteractives = function enableAndFocusInteractives(headerNode) {
|
|
175
|
-
var interactiveElements = headerNode.querySelectorAll('[data-euigrid-tab-managed]');
|
|
176
|
-
interactiveElements.forEach(function (element, i) {
|
|
177
|
-
element.setAttribute('tabIndex', '0');
|
|
178
|
-
if (i === 0) {
|
|
179
|
-
element.focus();
|
|
180
|
-
}
|
|
181
|
-
});
|
|
106
|
+
className: _propTypes.default.string,
|
|
107
|
+
hasActionsPopover: _propTypes.default.bool,
|
|
108
|
+
isActionsButtonFocused: _propTypes.default.bool,
|
|
109
|
+
focusActionsButton: _propTypes.default.func
|
|
182
110
|
};
|
|
@@ -15,7 +15,7 @@ var _data_grid_control_header_cell = require("./data_grid_control_header_cell");
|
|
|
15
15
|
var _data_grid_header_cell = require("./data_grid_header_cell");
|
|
16
16
|
var _data_grid_types = require("../../data_grid_types");
|
|
17
17
|
var _react2 = require("@emotion/react");
|
|
18
|
-
var _excluded = ["leadingControlColumns", "trailingControlColumns", "columns", "schema", "schemaDetectors", "columnWidths", "defaultColumnWidth", "className", "setColumnWidth", "setVisibleColumns", "switchColumnPos", "
|
|
18
|
+
var _excluded = ["leadingControlColumns", "trailingControlColumns", "columns", "schema", "schemaDetectors", "columnWidths", "defaultColumnWidth", "className", "setColumnWidth", "setVisibleColumns", "switchColumnPos", "data-test-subj"];
|
|
19
19
|
/*
|
|
20
20
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
21
21
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
@@ -39,7 +39,6 @@ var EuiDataGridHeaderRow = /*#__PURE__*/(0, _react.forwardRef)(function (props,
|
|
|
39
39
|
setColumnWidth = props.setColumnWidth,
|
|
40
40
|
setVisibleColumns = props.setVisibleColumns,
|
|
41
41
|
switchColumnPos = props.switchColumnPos,
|
|
42
|
-
headerIsInteractive = props.headerIsInteractive,
|
|
43
42
|
_dataTestSubj = props['data-test-subj'],
|
|
44
43
|
rest = (0, _objectWithoutProperties2.default)(props, _excluded);
|
|
45
44
|
var classes = (0, _classnames.default)('euiDataGridHeader', className);
|
|
@@ -53,8 +52,7 @@ var EuiDataGridHeaderRow = /*#__PURE__*/(0, _react.forwardRef)(function (props,
|
|
|
53
52
|
return (0, _react2.jsx)(_data_grid_control_header_cell.EuiDataGridControlHeaderCell, {
|
|
54
53
|
key: controlColumn.id,
|
|
55
54
|
index: index,
|
|
56
|
-
controlColumn: controlColumn
|
|
57
|
-
headerIsInteractive: headerIsInteractive
|
|
55
|
+
controlColumn: controlColumn
|
|
58
56
|
});
|
|
59
57
|
}), columns.map(function (column, index) {
|
|
60
58
|
return (0, _react2.jsx)(_data_grid_header_cell.EuiDataGridHeaderCell, {
|
|
@@ -68,15 +66,13 @@ var EuiDataGridHeaderRow = /*#__PURE__*/(0, _react.forwardRef)(function (props,
|
|
|
68
66
|
setColumnWidth: setColumnWidth,
|
|
69
67
|
setVisibleColumns: setVisibleColumns,
|
|
70
68
|
switchColumnPos: switchColumnPos,
|
|
71
|
-
defaultColumnWidth: defaultColumnWidth
|
|
72
|
-
headerIsInteractive: headerIsInteractive
|
|
69
|
+
defaultColumnWidth: defaultColumnWidth
|
|
73
70
|
});
|
|
74
71
|
}), trailingControlColumns.map(function (controlColumn, index) {
|
|
75
72
|
return (0, _react2.jsx)(_data_grid_control_header_cell.EuiDataGridControlHeaderCell, {
|
|
76
73
|
key: controlColumn.id,
|
|
77
74
|
index: index + leadingControlColumns.length + columns.length,
|
|
78
|
-
controlColumn: controlColumn
|
|
79
|
-
headerIsInteractive: headerIsInteractive
|
|
75
|
+
controlColumn: controlColumn
|
|
80
76
|
});
|
|
81
77
|
}));
|
|
82
78
|
});
|
|
@@ -616,7 +612,6 @@ EuiDataGridHeaderRow.propTypes = {
|
|
|
616
612
|
defaultColumnWidth: _propTypes.default.oneOfType([_propTypes.default.number.isRequired, _propTypes.default.oneOf([null])]),
|
|
617
613
|
setColumnWidth: _propTypes.default.func.isRequired,
|
|
618
614
|
setVisibleColumns: _propTypes.default.func.isRequired,
|
|
619
|
-
switchColumnPos: _propTypes.default.func.isRequired
|
|
620
|
-
headerIsInteractive: _propTypes.default.bool.isRequired
|
|
615
|
+
switchColumnPos: _propTypes.default.func.isRequired
|
|
621
616
|
};
|
|
622
617
|
EuiDataGridHeaderRow.displayName = 'EuiDataGridHeaderRow';
|
|
@@ -8,14 +8,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
8
8
|
exports.useDataGridHeader = void 0;
|
|
9
9
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
10
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
11
|
-
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
12
11
|
var _react = _interopRequireWildcard(require("react"));
|
|
13
|
-
var _mutation_observer = require("../../../observer/mutation_observer");
|
|
14
12
|
var _resize_observer = require("../../../observer/resize_observer");
|
|
15
|
-
var _focus = require("../../utils/focus");
|
|
16
13
|
var _data_grid_header_row = require("./data_grid_header_row");
|
|
17
14
|
var _react2 = require("@emotion/react");
|
|
18
|
-
|
|
15
|
+
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); }
|
|
16
|
+
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; }
|
|
19
17
|
/*
|
|
20
18
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
21
19
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
@@ -23,22 +21,15 @@ var _excluded = ["handleHeaderMutation"];
|
|
|
23
21
|
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
24
22
|
* Side Public License, v 1.
|
|
25
23
|
*/
|
|
26
|
-
|
|
27
|
-
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
|
+
|
|
28
25
|
/**
|
|
29
26
|
* DRY out setting up the grid header and its refs & observers
|
|
30
27
|
*/
|
|
31
|
-
var useDataGridHeader = function useDataGridHeader(
|
|
32
|
-
var handleHeaderMutation = _ref.handleHeaderMutation,
|
|
33
|
-
props = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
28
|
+
var useDataGridHeader = function useDataGridHeader(props) {
|
|
34
29
|
var _useState = (0, _react.useState)(null),
|
|
35
30
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
36
31
|
headerRowRef = _useState2[0],
|
|
37
32
|
setHeaderRowRef = _useState2[1];
|
|
38
|
-
(0, _mutation_observer.useMutationObserver)(headerRowRef, handleHeaderMutation, {
|
|
39
|
-
subtree: true,
|
|
40
|
-
childList: true
|
|
41
|
-
});
|
|
42
33
|
var _useResizeObserver = (0, _resize_observer.useResizeObserver)(headerRowRef, 'height'),
|
|
43
34
|
headerRowHeight = _useResizeObserver.height;
|
|
44
35
|
var headerRow = (0, _react.useMemo)(function () {
|
|
@@ -47,7 +38,6 @@ var useDataGridHeader = function useDataGridHeader(_ref) {
|
|
|
47
38
|
}, props));
|
|
48
39
|
}, Object.values(props)); // eslint-disable-line react-hooks/exhaustive-deps
|
|
49
40
|
|
|
50
|
-
(0, _focus.useHeaderFocusWorkaround)(props.headerIsInteractive);
|
|
51
41
|
return {
|
|
52
42
|
headerRow: headerRow,
|
|
53
43
|
headerRowHeight: headerRowHeight
|
|
@@ -24,8 +24,7 @@ var _controls = require("./controls");
|
|
|
24
24
|
var _sorting = require("./utils/sorting");
|
|
25
25
|
var _focus = require("./utils/focus");
|
|
26
26
|
var _in_memory = require("./utils/in_memory");
|
|
27
|
-
var
|
|
28
|
-
var _data_grid_cell_popover = require("./body/data_grid_cell_popover");
|
|
27
|
+
var _cell = require("./body/cell");
|
|
29
28
|
var _row_count = require("./utils/row_count");
|
|
30
29
|
var _data_grid_pagination = require("./utils/data_grid_pagination");
|
|
31
30
|
var _data_grid_schema = require("./utils/data_grid_schema");
|
|
@@ -207,20 +206,14 @@ var EuiDataGrid = /*#__PURE__*/(0, _react.memo)( /*#__PURE__*/(0, _react.forward
|
|
|
207
206
|
/**
|
|
208
207
|
* Focus
|
|
209
208
|
*/
|
|
210
|
-
var
|
|
211
|
-
headerIsInteractive = _useHeaderIsInteracti.headerIsInteractive,
|
|
212
|
-
handleHeaderMutation = _useHeaderIsInteracti.handleHeaderMutation;
|
|
213
|
-
var _useFocus = (0, _focus.useFocus)({
|
|
214
|
-
headerIsInteractive: headerIsInteractive,
|
|
215
|
-
gridItemsRendered: gridItemsRendered
|
|
216
|
-
}),
|
|
209
|
+
var _useFocus = (0, _focus.useFocus)(),
|
|
217
210
|
wrappingDivFocusProps = _useFocus.focusProps,
|
|
218
211
|
focusContext = (0, _objectWithoutProperties2.default)(_useFocus, _excluded2);
|
|
219
212
|
|
|
220
213
|
/**
|
|
221
214
|
* Cell popover
|
|
222
215
|
*/
|
|
223
|
-
var _useCellPopover = (0,
|
|
216
|
+
var _useCellPopover = (0, _cell.useCellPopover)(),
|
|
224
217
|
cellPopoverContext = _useCellPopover.cellPopoverContext,
|
|
225
218
|
cellPopover = _useCellPopover.cellPopover;
|
|
226
219
|
|
|
@@ -294,7 +287,7 @@ var EuiDataGrid = /*#__PURE__*/(0, _react.memo)( /*#__PURE__*/(0, _react.forward
|
|
|
294
287
|
}
|
|
295
288
|
return (0, _react2.jsx)(_focus.DataGridFocusContext.Provider, {
|
|
296
289
|
value: focusContext
|
|
297
|
-
}, (0, _react2.jsx)(
|
|
290
|
+
}, (0, _react2.jsx)(_cell.DataGridCellPopoverContext.Provider, {
|
|
298
291
|
value: cellPopoverContext
|
|
299
292
|
}, (0, _react2.jsx)(_sorting.DataGridSortingContext.Provider, {
|
|
300
293
|
value: sortingContext
|
|
@@ -341,7 +334,6 @@ var EuiDataGrid = /*#__PURE__*/(0, _react.memo)( /*#__PURE__*/(0, _react.forward
|
|
|
341
334
|
rowCount: rowCount,
|
|
342
335
|
pagination: pagination,
|
|
343
336
|
hasFooter: !!renderFooterCellValue,
|
|
344
|
-
headerIsInteractive: headerIsInteractive,
|
|
345
337
|
focusContext: focusContext
|
|
346
338
|
}),
|
|
347
339
|
"data-test-subj": "euiDataGridBody",
|
|
@@ -358,8 +350,6 @@ var EuiDataGrid = /*#__PURE__*/(0, _react.memo)( /*#__PURE__*/(0, _react.forward
|
|
|
358
350
|
setVisibleColumns: setVisibleColumns,
|
|
359
351
|
switchColumnPos: switchColumnPos,
|
|
360
352
|
onColumnResize: onColumnResize,
|
|
361
|
-
headerIsInteractive: headerIsInteractive,
|
|
362
|
-
handleHeaderMutation: handleHeaderMutation,
|
|
363
353
|
schemaDetectors: allSchemaDetectors,
|
|
364
354
|
pagination: pagination,
|
|
365
355
|
renderCellValue: renderCellValue,
|
|
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.
|
|
7
|
+
exports.useFocus = exports.preventTabbing = exports.notifyCellOfFocusState = exports.getParentCellContent = exports.createKeyDownHandler = exports.DataGridFocusContext = void 0;
|
|
8
8
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
9
9
|
var _react = require("react");
|
|
10
10
|
var _tabbable = require("tabbable");
|
|
@@ -30,9 +30,7 @@ exports.DataGridFocusContext = DataGridFocusContext;
|
|
|
30
30
|
/**
|
|
31
31
|
* Main focus context and overarching focus state management
|
|
32
32
|
*/
|
|
33
|
-
var useFocus = function useFocus(
|
|
34
|
-
var headerIsInteractive = _ref.headerIsInteractive,
|
|
35
|
-
gridItemsRendered = _ref.gridItemsRendered;
|
|
33
|
+
var useFocus = function useFocus() {
|
|
36
34
|
// Maintain a map of focus cell state callbacks
|
|
37
35
|
var cellsUpdateFocus = (0, _react.useRef)(new Map());
|
|
38
36
|
var onFocusUpdate = (0, _react.useCallback)(function (cell, updateFocus) {
|
|
@@ -53,14 +51,17 @@ var useFocus = function useFocus(_ref) {
|
|
|
53
51
|
focusedCell = _useState4[0],
|
|
54
52
|
_setFocusedCell = _useState4[1];
|
|
55
53
|
var setFocusedCell = (0, _react.useCallback)(function (nextFocusedCell) {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
54
|
+
_setFocusedCell(function (prevFocusedCell) {
|
|
55
|
+
// If the x/y coordinates remained the same, don't update. This keeps the focusedCell
|
|
56
|
+
// reference stable, and allows it to be used in places that need reference equality.
|
|
57
|
+
if (nextFocusedCell[0] === (prevFocusedCell === null || prevFocusedCell === void 0 ? void 0 : prevFocusedCell[0]) && nextFocusedCell[1] === (prevFocusedCell === null || prevFocusedCell === void 0 ? void 0 : prevFocusedCell[1])) {
|
|
58
|
+
return prevFocusedCell;
|
|
59
|
+
} else {
|
|
60
|
+
setIsFocusedCellInView(true); // scrolling.ts ensures focused cells are fully in view
|
|
61
|
+
return nextFocusedCell;
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
}, []);
|
|
64
65
|
var previousCell = (0, _react.useRef)(undefined);
|
|
65
66
|
(0, _react.useEffect)(function () {
|
|
66
67
|
if (previousCell.current) {
|
|
@@ -72,19 +73,8 @@ var useFocus = function useFocus(_ref) {
|
|
|
72
73
|
}
|
|
73
74
|
}, [cellsUpdateFocus, focusedCell]);
|
|
74
75
|
var focusFirstVisibleInteractiveCell = (0, _react.useCallback)(function () {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
setFocusedCell([0, -1]);
|
|
78
|
-
} else if (gridItemsRendered.current) {
|
|
79
|
-
var _gridItemsRendered$cu = gridItemsRendered.current,
|
|
80
|
-
visibleColumnStartIndex = _gridItemsRendered$cu.visibleColumnStartIndex,
|
|
81
|
-
visibleRowStartIndex = _gridItemsRendered$cu.visibleRowStartIndex;
|
|
82
|
-
setFocusedCell([visibleColumnStartIndex, visibleRowStartIndex]);
|
|
83
|
-
} else {
|
|
84
|
-
// If the header is non-interactive and there are no rendered cells,
|
|
85
|
-
// there's nothing to do - we might as well leave focus on the grid body wrapper
|
|
86
|
-
}
|
|
87
|
-
}, [setFocusedCell, headerIsInteractive, gridItemsRendered]);
|
|
76
|
+
setFocusedCell([0, -1]);
|
|
77
|
+
}, [setFocusedCell]);
|
|
88
78
|
var focusProps = (0, _react.useMemo)(function () {
|
|
89
79
|
return isFocusedCellInView ? {
|
|
90
80
|
// FireFox allows tabbing to a div that is scrollable, while Chrome does not
|
|
@@ -127,16 +117,15 @@ var notifyCellOfFocusState = function notifyCellOfFocusState(cellsUpdateFocus, c
|
|
|
127
117
|
* Keydown handler for connecting focus state with keyboard navigation
|
|
128
118
|
*/
|
|
129
119
|
exports.notifyCellOfFocusState = notifyCellOfFocusState;
|
|
130
|
-
var createKeyDownHandler = function createKeyDownHandler(
|
|
131
|
-
var gridElement =
|
|
132
|
-
visibleColCount =
|
|
133
|
-
visibleRowCount =
|
|
134
|
-
visibleRowStartIndex =
|
|
135
|
-
rowCount =
|
|
136
|
-
pagination =
|
|
137
|
-
hasFooter =
|
|
138
|
-
|
|
139
|
-
focusContext = _ref2.focusContext;
|
|
120
|
+
var createKeyDownHandler = function createKeyDownHandler(_ref) {
|
|
121
|
+
var gridElement = _ref.gridElement,
|
|
122
|
+
visibleColCount = _ref.visibleColCount,
|
|
123
|
+
visibleRowCount = _ref.visibleRowCount,
|
|
124
|
+
visibleRowStartIndex = _ref.visibleRowStartIndex,
|
|
125
|
+
rowCount = _ref.rowCount,
|
|
126
|
+
pagination = _ref.pagination,
|
|
127
|
+
hasFooter = _ref.hasFooter,
|
|
128
|
+
focusContext = _ref.focusContext;
|
|
140
129
|
return function (event) {
|
|
141
130
|
var focusedCell = focusContext.focusedCell,
|
|
142
131
|
setFocusedCell = focusContext.setFocusedCell;
|
|
@@ -170,8 +159,7 @@ var createKeyDownHandler = function createKeyDownHandler(_ref2) {
|
|
|
170
159
|
}
|
|
171
160
|
} else if (key === _services.keys.ARROW_UP) {
|
|
172
161
|
event.preventDefault();
|
|
173
|
-
|
|
174
|
-
if (y > minimumIndex) {
|
|
162
|
+
if (y > -1) {
|
|
175
163
|
setFocusedCell([x, y - 1]);
|
|
176
164
|
}
|
|
177
165
|
} else if (key === _services.keys.ARROW_RIGHT) {
|
|
@@ -261,22 +249,4 @@ var getParentCellContent = function getParentCellContent(_element) {
|
|
|
261
249
|
}
|
|
262
250
|
return element;
|
|
263
251
|
};
|
|
264
|
-
|
|
265
|
-
/**
|
|
266
|
-
* Focus fixes & workarounds
|
|
267
|
-
*/
|
|
268
|
-
|
|
269
|
-
// If the focus is on the header, and the header is no longer interactive,
|
|
270
|
-
// move the focus down to the first row
|
|
271
|
-
exports.getParentCellContent = getParentCellContent;
|
|
272
|
-
var useHeaderFocusWorkaround = function useHeaderFocusWorkaround(headerIsInteractive) {
|
|
273
|
-
var _useContext = (0, _react.useContext)(DataGridFocusContext),
|
|
274
|
-
focusedCell = _useContext.focusedCell,
|
|
275
|
-
setFocusedCell = _useContext.setFocusedCell;
|
|
276
|
-
(0, _react.useEffect)(function () {
|
|
277
|
-
if (!headerIsInteractive && focusedCell && focusedCell[1] === -1) {
|
|
278
|
-
setFocusedCell([focusedCell[0], 0]);
|
|
279
|
-
}
|
|
280
|
-
}, [headerIsInteractive, focusedCell, setFocusedCell]);
|
|
281
|
-
};
|
|
282
|
-
exports.useHeaderFocusWorkaround = useHeaderFocusWorkaround;
|
|
252
|
+
exports.getParentCellContent = getParentCellContent;
|
|
@@ -9,7 +9,7 @@ exports.useScrollCellIntoView = exports.useScrollBars = exports.useScroll = void
|
|
|
9
9
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
10
10
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
11
11
|
var _react = _interopRequireWildcard(require("react"));
|
|
12
|
-
var
|
|
12
|
+
var _cell = require("../body/cell");
|
|
13
13
|
var _focus = require("./focus");
|
|
14
14
|
var _react2 = require("@emotion/react");
|
|
15
15
|
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); }
|
|
@@ -41,7 +41,7 @@ var useScroll = function useScroll(args) {
|
|
|
41
41
|
});
|
|
42
42
|
}
|
|
43
43
|
}, [focusedCell, scrollCellIntoView]);
|
|
44
|
-
var _useContext2 = (0, _react.useContext)(
|
|
44
|
+
var _useContext2 = (0, _react.useContext)(_cell.DataGridCellPopoverContext),
|
|
45
45
|
popoverIsOpen = _useContext2.popoverIsOpen,
|
|
46
46
|
cellLocation = _useContext2.cellLocation;
|
|
47
47
|
(0, _react.useEffect)(function () {
|
|
@@ -12,10 +12,11 @@ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/h
|
|
|
12
12
|
var _react = _interopRequireWildcard(require("react"));
|
|
13
13
|
var _services = require("../../services");
|
|
14
14
|
var _resizable_container = require("../resizable_container");
|
|
15
|
+
var _helpers = require("../resizable_container/helpers");
|
|
15
16
|
var _flyout = require("./flyout");
|
|
16
17
|
var _flyout_resizable = require("./flyout_resizable.styles");
|
|
17
18
|
var _react2 = require("@emotion/react");
|
|
18
|
-
var _excluded = ["size", "maxWidth", "minWidth", "side", "children"];
|
|
19
|
+
var _excluded = ["size", "maxWidth", "minWidth", "side", "type", "children"];
|
|
19
20
|
/*
|
|
20
21
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
21
22
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
@@ -32,11 +33,13 @@ var EuiFlyoutResizable = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref
|
|
|
32
33
|
minWidth = _ref$minWidth === void 0 ? 200 : _ref$minWidth,
|
|
33
34
|
_ref$side = _ref.side,
|
|
34
35
|
side = _ref$side === void 0 ? 'right' : _ref$side,
|
|
36
|
+
_ref$type = _ref.type,
|
|
37
|
+
type = _ref$type === void 0 ? 'overlay' : _ref$type,
|
|
35
38
|
children = _ref.children,
|
|
36
39
|
rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
37
40
|
var euiTheme = (0, _services.useEuiTheme)();
|
|
38
41
|
var styles = (0, _flyout_resizable.euiFlyoutResizableButtonStyles)(euiTheme);
|
|
39
|
-
var cssStyles = [styles.euiFlyoutResizableButton, styles[side]];
|
|
42
|
+
var cssStyles = [styles.euiFlyoutResizableButton, styles[type][side]];
|
|
40
43
|
var getFlyoutMinMaxWidth = (0, _react.useCallback)(function (width) {
|
|
41
44
|
return Math.min(Math.max(width, minWidth), maxWidth || Infinity, window.innerWidth - 20 // Leave some offset
|
|
42
45
|
);
|
|
@@ -70,7 +73,7 @@ var EuiFlyoutResizable = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref
|
|
|
70
73
|
return modifier;
|
|
71
74
|
}, [side, flyoutRef]);
|
|
72
75
|
var onMouseMove = (0, _react.useCallback)(function (e) {
|
|
73
|
-
var mouseOffset =
|
|
76
|
+
var mouseOffset = (0, _helpers.getPosition)(e, true) - initialMouseX.current;
|
|
74
77
|
var changedFlyoutWidth = initialWidth.current + mouseOffset * direction;
|
|
75
78
|
setFlyoutWidth(getFlyoutMinMaxWidth(changedFlyoutWidth));
|
|
76
79
|
}, [getFlyoutMinMaxWidth, direction]);
|
|
@@ -83,7 +86,7 @@ var EuiFlyoutResizable = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref
|
|
|
83
86
|
}, [onMouseMove]);
|
|
84
87
|
var onMouseDown = (0, _react.useCallback)(function (e) {
|
|
85
88
|
var _flyoutRef$offsetWidt;
|
|
86
|
-
initialMouseX.current =
|
|
89
|
+
initialMouseX.current = (0, _helpers.getPosition)(e, true);
|
|
87
90
|
initialWidth.current = (_flyoutRef$offsetWidt = flyoutRef === null || flyoutRef === void 0 ? void 0 : flyoutRef.offsetWidth) !== null && _flyoutRef$offsetWidt !== void 0 ? _flyoutRef$offsetWidt : 0;
|
|
88
91
|
|
|
89
92
|
// Window event listeners instead of React events are used
|
|
@@ -113,9 +116,11 @@ var EuiFlyoutResizable = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref
|
|
|
113
116
|
size: flyoutWidth || size,
|
|
114
117
|
maxWidth: maxWidth,
|
|
115
118
|
side: side,
|
|
119
|
+
type: type,
|
|
116
120
|
ref: setRefs
|
|
117
121
|
}), (0, _react2.jsx)(_resizable_container.EuiResizableButton, {
|
|
118
122
|
isHorizontal: true,
|
|
123
|
+
indicator: "border",
|
|
119
124
|
css: cssStyles,
|
|
120
125
|
onMouseDown: onMouseDown,
|
|
121
126
|
onTouchStart: onMouseDown,
|
|
@@ -123,9 +128,4 @@ var EuiFlyoutResizable = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref
|
|
|
123
128
|
}), children);
|
|
124
129
|
});
|
|
125
130
|
exports.EuiFlyoutResizable = EuiFlyoutResizable;
|
|
126
|
-
EuiFlyoutResizable.displayName = 'EuiFlyoutResizable';
|
|
127
|
-
var getMouseOrTouchX = function getMouseOrTouchX(e) {
|
|
128
|
-
// Some Typescript fooling is needed here
|
|
129
|
-
var x = e.targetTouches ? e.targetTouches[0].pageX : e.pageX;
|
|
130
|
-
return x;
|
|
131
|
-
};
|
|
131
|
+
EuiFlyoutResizable.displayName = 'EuiFlyoutResizable';
|
|
@@ -14,19 +14,25 @@ function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringif
|
|
|
14
14
|
* Side Public License, v 1.
|
|
15
15
|
*/
|
|
16
16
|
var _ref = process.env.NODE_ENV === "production" ? {
|
|
17
|
-
name: "
|
|
18
|
-
styles: "position:absolute
|
|
17
|
+
name: "1gfwqnd-euiFlyoutResizableButton",
|
|
18
|
+
styles: "position:absolute;label:euiFlyoutResizableButton;"
|
|
19
19
|
} : {
|
|
20
|
-
name: "
|
|
21
|
-
styles: "position:absolute
|
|
20
|
+
name: "1gfwqnd-euiFlyoutResizableButton",
|
|
21
|
+
styles: "position:absolute;label:euiFlyoutResizableButton;",
|
|
22
22
|
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
23
23
|
};
|
|
24
24
|
var euiFlyoutResizableButtonStyles = function euiFlyoutResizableButtonStyles(_ref2) {
|
|
25
25
|
var euiTheme = _ref2.euiTheme;
|
|
26
26
|
return {
|
|
27
27
|
euiFlyoutResizableButton: _ref,
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
overlay: {
|
|
29
|
+
left: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('right', 0), ";;label:left;"),
|
|
30
|
+
right: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('left', 0), ";;label:right;")
|
|
31
|
+
},
|
|
32
|
+
push: {
|
|
33
|
+
left: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('right', "-".concat(euiTheme.border.width.thin)), ";;label:left;"),
|
|
34
|
+
right: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('left', "-".concat(euiTheme.border.width.thin)), ";;label:right;")
|
|
35
|
+
}
|
|
30
36
|
};
|
|
31
37
|
};
|
|
32
38
|
exports.euiFlyoutResizableButtonStyles = euiFlyoutResizableButtonStyles;
|