@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
|
@@ -14,7 +14,7 @@ var _data_grid_control_header_cell = require("./data_grid_control_header_cell");
|
|
|
14
14
|
var _data_grid_header_cell = require("./data_grid_header_cell");
|
|
15
15
|
var _data_grid_types = require("../../data_grid_types");
|
|
16
16
|
var _react2 = require("@emotion/react");
|
|
17
|
-
var _excluded = ["leadingControlColumns", "trailingControlColumns", "columns", "schema", "schemaDetectors", "columnWidths", "defaultColumnWidth", "className", "setColumnWidth", "setVisibleColumns", "switchColumnPos", "
|
|
17
|
+
var _excluded = ["leadingControlColumns", "trailingControlColumns", "columns", "schema", "schemaDetectors", "columnWidths", "defaultColumnWidth", "className", "setColumnWidth", "setVisibleColumns", "switchColumnPos", "data-test-subj"];
|
|
18
18
|
/*
|
|
19
19
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
20
20
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
@@ -38,7 +38,6 @@ var EuiDataGridHeaderRow = /*#__PURE__*/(0, _react.forwardRef)(function (props,
|
|
|
38
38
|
setColumnWidth = props.setColumnWidth,
|
|
39
39
|
setVisibleColumns = props.setVisibleColumns,
|
|
40
40
|
switchColumnPos = props.switchColumnPos,
|
|
41
|
-
headerIsInteractive = props.headerIsInteractive,
|
|
42
41
|
_dataTestSubj = props['data-test-subj'],
|
|
43
42
|
rest = (0, _objectWithoutProperties2.default)(props, _excluded);
|
|
44
43
|
var classes = (0, _classnames.default)('euiDataGridHeader', className);
|
|
@@ -52,8 +51,7 @@ var EuiDataGridHeaderRow = /*#__PURE__*/(0, _react.forwardRef)(function (props,
|
|
|
52
51
|
return (0, _react2.jsx)(_data_grid_control_header_cell.EuiDataGridControlHeaderCell, {
|
|
53
52
|
key: controlColumn.id,
|
|
54
53
|
index: index,
|
|
55
|
-
controlColumn: controlColumn
|
|
56
|
-
headerIsInteractive: headerIsInteractive
|
|
54
|
+
controlColumn: controlColumn
|
|
57
55
|
});
|
|
58
56
|
}), columns.map(function (column, index) {
|
|
59
57
|
return (0, _react2.jsx)(_data_grid_header_cell.EuiDataGridHeaderCell, {
|
|
@@ -67,15 +65,13 @@ var EuiDataGridHeaderRow = /*#__PURE__*/(0, _react.forwardRef)(function (props,
|
|
|
67
65
|
setColumnWidth: setColumnWidth,
|
|
68
66
|
setVisibleColumns: setVisibleColumns,
|
|
69
67
|
switchColumnPos: switchColumnPos,
|
|
70
|
-
defaultColumnWidth: defaultColumnWidth
|
|
71
|
-
headerIsInteractive: headerIsInteractive
|
|
68
|
+
defaultColumnWidth: defaultColumnWidth
|
|
72
69
|
});
|
|
73
70
|
}), trailingControlColumns.map(function (controlColumn, index) {
|
|
74
71
|
return (0, _react2.jsx)(_data_grid_control_header_cell.EuiDataGridControlHeaderCell, {
|
|
75
72
|
key: controlColumn.id,
|
|
76
73
|
index: index + leadingControlColumns.length + columns.length,
|
|
77
|
-
controlColumn: controlColumn
|
|
78
|
-
headerIsInteractive: headerIsInteractive
|
|
74
|
+
controlColumn: controlColumn
|
|
79
75
|
});
|
|
80
76
|
}));
|
|
81
77
|
});
|
|
@@ -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;
|
|
@@ -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.useContainerCallbacks = exports.sizesOnly = exports.pxToPercent = exports.getPosition = exports.getPanelMinSize = void 0;
|
|
7
|
+
exports.useContainerCallbacks = exports.sizesOnly = exports.pxToPercent = exports.isTouchEvent = exports.getPosition = exports.getPanelMinSize = void 0;
|
|
8
8
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
9
9
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
10
|
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
@@ -18,9 +18,10 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
18
18
|
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
19
19
|
* Side Public License, v 1.
|
|
20
20
|
*/
|
|
21
|
-
function
|
|
22
|
-
return (0, _typeof2.default)(event) === 'object' && '
|
|
23
|
-
}
|
|
21
|
+
var isTouchEvent = function isTouchEvent(event) {
|
|
22
|
+
return (0, _typeof2.default)(event) === 'object' && 'targetTouches' in event;
|
|
23
|
+
};
|
|
24
|
+
exports.isTouchEvent = isTouchEvent;
|
|
24
25
|
var pxToPercent = function pxToPercent(proportion, whole) {
|
|
25
26
|
if (whole < 1 || proportion < 0) return 0;
|
|
26
27
|
return proportion / whole * 100;
|
|
@@ -50,9 +51,8 @@ var getPanelMinSize = function getPanelMinSize(panelMinSize, containerSize) {
|
|
|
50
51
|
};
|
|
51
52
|
exports.getPanelMinSize = getPanelMinSize;
|
|
52
53
|
var getPosition = function getPosition(event, isHorizontal) {
|
|
53
|
-
var
|
|
54
|
-
|
|
55
|
-
return isHorizontal ? clientX : clientY;
|
|
54
|
+
var direction = isHorizontal ? 'clientX' : 'clientY';
|
|
55
|
+
return isTouchEvent(event) ? event.targetTouches[0][direction] : event[direction];
|
|
56
56
|
};
|
|
57
57
|
exports.getPosition = getPosition;
|
|
58
58
|
var getSiblingPanel = function getSiblingPanel(element, adjacency) {
|
|
@@ -16,7 +16,7 @@ var _services = require("../../services");
|
|
|
16
16
|
var _context = require("./context");
|
|
17
17
|
var _resizable_button = require("./resizable_button.styles");
|
|
18
18
|
var _react2 = require("@emotion/react");
|
|
19
|
-
var _excluded = ["isHorizontal", "alignIndicator", "className"],
|
|
19
|
+
var _excluded = ["isHorizontal", "indicator", "alignIndicator", "className"],
|
|
20
20
|
_excluded2 = ["registration", "id", "disabled", "onFocus"];
|
|
21
21
|
/*
|
|
22
22
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
@@ -33,14 +33,17 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
33
33
|
*/
|
|
34
34
|
var EuiResizableButton = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
35
35
|
var isHorizontal = _ref.isHorizontal,
|
|
36
|
+
_ref$indicator = _ref.indicator,
|
|
37
|
+
indicator = _ref$indicator === void 0 ? 'handle' : _ref$indicator,
|
|
36
38
|
_ref$alignIndicator = _ref.alignIndicator,
|
|
37
39
|
alignIndicator = _ref$alignIndicator === void 0 ? 'center' : _ref$alignIndicator,
|
|
38
40
|
className = _ref.className,
|
|
39
41
|
rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
40
42
|
var classes = (0, _classnames.default)('euiResizableButton', className);
|
|
43
|
+
var resizeDirection = isHorizontal ? 'horizontal' : 'vertical';
|
|
41
44
|
var euiTheme = (0, _services.useEuiTheme)();
|
|
42
45
|
var styles = (0, _resizable_button.euiResizableButtonStyles)(euiTheme);
|
|
43
|
-
var cssStyles = [styles.euiResizableButton,
|
|
46
|
+
var cssStyles = [styles.euiResizableButton, styles[indicator], styles["".concat(indicator, "Direction")][resizeDirection], styles[resizeDirection], indicator === 'handle' && styles.alignIndicator[alignIndicator]];
|
|
44
47
|
return (0, _react2.jsx)(_i18n.EuiI18n, {
|
|
45
48
|
tokens: ['euiResizableButton.horizontalResizerAriaLabel', 'euiResizableButton.verticalResizerAriaLabel'],
|
|
46
49
|
defaults: ['Press the left or right arrow keys to adjust panels size', 'Press the up or down arrow keys to adjust panels size']
|
|
@@ -46,21 +46,31 @@ var euiResizableButtonStyles = function euiResizableButtonStyles(euiThemeContext
|
|
|
46
46
|
var transitionSpeed = euiTheme.animation.fast;
|
|
47
47
|
var transition = "".concat(transitionSpeed, " ease");
|
|
48
48
|
return {
|
|
49
|
-
//
|
|
50
|
-
// 1. The "grab"
|
|
51
|
-
// 2. Start/end aligned handles should have a slight margin offset that disappears on hover/focus
|
|
49
|
+
// Creates a resizable indicator (either a grab handle or a plain border) with CSS psuedo-elements.
|
|
50
|
+
// 1. The "grab" handle transforms into a thicker straight line on :hover and :focus
|
|
51
|
+
// 2. Start/end aligned grab handles should have a slight margin offset that disappears on hover/focus
|
|
52
52
|
// 3. CSS hack to smooth out/anti-alias the 1px wide handles at various zoom levels
|
|
53
|
-
euiResizableButton: /*#__PURE__*/(0, _react.css)("z-index:1;flex-shrink:0;display:flex;justify-content:center;
|
|
54
|
-
return x * 2;
|
|
55
|
-
}), ";&:disabled{display:none;}&:hover,&:focus{gap:0;justify-content:center;}", _global_styling.euiCanAnimate, "{transition:gap ", transition, ",justify-content ", transition, ";}&::before,&::after{content:'';display:block;background-color:", euiTheme.colors.darkestShade, ";transform:translateZ(0);", _global_styling.euiCanAnimate, "{transition:width ", transition, ",height ", transition, ",margin ", transition, ",background-color ", transition, ";}}&:hover{&::before,&::after{background-color:", euiTheme.colors.mediumShade, ";", _global_styling.euiCanAnimate, "{transition-delay:", transitionSpeed, ";}}}&:focus,&:active{background-color:", (0, _services.transparentize)(euiTheme.colors.primary, 0.1), ";&::before,&::after{background-color:", euiTheme.colors.primary, ";", _global_styling.euiCanAnimate, "{transition:width ", transition, ",height ", transition, ";transition-delay:", (0, _global_styling.mathWithUnits)(transitionSpeed, function (x) {
|
|
53
|
+
euiResizableButton: /*#__PURE__*/(0, _react.css)("z-index:1;flex-shrink:0;display:flex;justify-content:center;&:disabled{display:none;}&::before,&::after{content:'';display:block;", _global_styling.euiCanAnimate, "{transition:width ", transition, ",height ", transition, ",margin ", transition, ",background-color ", transition, ";}}&:hover{&::before,&::after{background-color:", euiTheme.colors.mediumShade, ";}}&:focus,&:active{background-color:", (0, _services.transparentize)(euiTheme.colors.primary, 0.1), ";&::before,&::after{background-color:", euiTheme.colors.primary, ";", _global_styling.euiCanAnimate, "{transition:width ", transition, ",height ", transition, ";transition-delay:", (0, _global_styling.mathWithUnits)(transitionSpeed, function (x) {
|
|
56
54
|
return x / 2;
|
|
57
55
|
}), ";}}};label:euiResizableButton;"),
|
|
58
56
|
horizontal: /*#__PURE__*/(0, _react.css)("cursor:col-resize;", (0, _global_styling.logicalCSS)('height', '100%'), " ", (0, _global_styling.logicalCSS)('width', buttonSize), " margin-inline:", (0, _global_styling.mathWithUnits)(buttonSize, function (x) {
|
|
59
57
|
return x / -2;
|
|
60
|
-
}), "
|
|
58
|
+
}), ";;label:horizontal;"),
|
|
61
59
|
vertical: /*#__PURE__*/(0, _react.css)("flex-direction:column;cursor:row-resize;", (0, _global_styling.logicalCSS)('width', '100%'), " ", (0, _global_styling.logicalCSS)('height', buttonSize), " margin-block:", (0, _global_styling.mathWithUnits)(buttonSize, function (x) {
|
|
62
60
|
return x / -2;
|
|
63
|
-
}), "
|
|
61
|
+
}), ";;label:vertical;"),
|
|
62
|
+
border: /*#__PURE__*/(0, _react.css)("&::before,&::after{background-color:", euiTheme.border.color, ";};label:border;"),
|
|
63
|
+
borderDirection: {
|
|
64
|
+
horizontal: /*#__PURE__*/(0, _react.css)("&::before{", (0, _global_styling.logicalCSS)('width', euiTheme.border.width.thin), " ", (0, _global_styling.logicalCSS)('height', '100%'), ";}&:hover,&:focus,&:active{&::after{", (0, _global_styling.logicalCSS)('width', euiTheme.border.width.thin), " ", (0, _global_styling.logicalCSS)('height', '100%'), ";}};label:horizontal;"),
|
|
65
|
+
vertical: /*#__PURE__*/(0, _react.css)("&::before{", (0, _global_styling.logicalCSS)('height', euiTheme.border.width.thin), " ", (0, _global_styling.logicalCSS)('width', '100%'), ";}&:hover,&:focus,&:active{&::after{", (0, _global_styling.logicalCSS)('height', euiTheme.border.width.thin), " ", (0, _global_styling.logicalCSS)('width', '100%'), ";}};label:vertical;")
|
|
66
|
+
},
|
|
67
|
+
handle: /*#__PURE__*/(0, _react.css)("gap:", (0, _global_styling.mathWithUnits)(grabHandleHeight, function (x) {
|
|
68
|
+
return x * 2;
|
|
69
|
+
}), ";&:hover,&:focus,&:active{gap:0;}", _global_styling.euiCanAnimate, "{transition:gap ", transition, ";}&::before,&::after{background-color:", euiTheme.colors.darkestShade, ";transform:translateZ(0);}&:hover{&::before,&::after{", _global_styling.euiCanAnimate, "{transition-delay:", transitionSpeed, ";}}};label:handle;"),
|
|
70
|
+
handleDirection: {
|
|
71
|
+
horizontal: /*#__PURE__*/(0, _react.css)("&::before,&::after{", (0, _global_styling.logicalCSS)('width', grabHandleHeight), " ", (0, _global_styling.logicalCSS)('height', grabHandleWidth), " margin-block:", euiTheme.size.base, ";}&:hover,&:focus,&:active{&::before,&::after{", (0, _global_styling.logicalCSS)('height', '100%'), " margin-block:0;transform:none;}};label:horizontal;"),
|
|
72
|
+
vertical: /*#__PURE__*/(0, _react.css)("&::before,&::after{", (0, _global_styling.logicalCSS)('height', grabHandleHeight), " ", (0, _global_styling.logicalCSS)('width', grabHandleWidth), " margin-inline:", euiTheme.size.base, ";}&:hover,&:focus,&:active{&::before,&::after{", (0, _global_styling.logicalCSS)('width', '100%'), " margin-inline:0;transform:none;}};label:vertical;")
|
|
73
|
+
},
|
|
64
74
|
alignIndicator: {
|
|
65
75
|
center: _ref3,
|
|
66
76
|
start: _ref2,
|
|
@@ -108,16 +108,33 @@ var EuiResizableContainer = function EuiResizableContainer(_ref) {
|
|
|
108
108
|
prevPanelId: prevPanelId,
|
|
109
109
|
nextPanelId: nextPanelId
|
|
110
110
|
});
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
if
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
position
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
111
|
+
|
|
112
|
+
// Window event listeners instead of React events are used to continue
|
|
113
|
+
// detecting movement even if the user's mouse leaves the container
|
|
114
|
+
|
|
115
|
+
var onMouseMove = function onMouseMove(event) {
|
|
116
|
+
var position = (0, _helpers.getPosition)(event, isHorizontal);
|
|
117
|
+
actions.dragMove({
|
|
118
|
+
position: position,
|
|
119
|
+
prevPanelId: prevPanelId,
|
|
120
|
+
nextPanelId: nextPanelId
|
|
121
|
+
});
|
|
122
|
+
};
|
|
123
|
+
var onMouseUp = function onMouseUp() {
|
|
124
|
+
if (resizeContext.current.trigger === 'pointer') {
|
|
125
|
+
resizeEnd();
|
|
126
|
+
}
|
|
127
|
+
actions.reset();
|
|
128
|
+
window.removeEventListener('mousemove', onMouseMove);
|
|
129
|
+
window.removeEventListener('mouseup', onMouseUp);
|
|
130
|
+
window.removeEventListener('touchmove', onMouseMove);
|
|
131
|
+
window.removeEventListener('touchend', onMouseUp);
|
|
132
|
+
};
|
|
133
|
+
window.addEventListener('mousemove', onMouseMove);
|
|
134
|
+
window.addEventListener('mouseup', onMouseUp);
|
|
135
|
+
window.addEventListener('touchmove', onMouseMove);
|
|
136
|
+
window.addEventListener('touchend', onMouseUp);
|
|
137
|
+
}, [actions, isHorizontal, resizeStart, resizeEnd]);
|
|
121
138
|
var getKeyMoveDirection = (0, _react.useCallback)(function (key) {
|
|
122
139
|
var direction = null;
|
|
123
140
|
if (isHorizontal && key === _services.keys.ARROW_LEFT || !isHorizontal && key === _services.keys.ARROW_UP) {
|
|
@@ -155,12 +172,6 @@ var EuiResizableContainer = function EuiResizableContainer(_ref) {
|
|
|
155
172
|
resizeEnd();
|
|
156
173
|
}
|
|
157
174
|
}, [getKeyMoveDirection, resizeEnd]);
|
|
158
|
-
var onMouseUp = (0, _react.useCallback)(function () {
|
|
159
|
-
if (resizeContext.current.trigger === 'pointer') {
|
|
160
|
-
resizeEnd();
|
|
161
|
-
}
|
|
162
|
-
actions.reset();
|
|
163
|
-
}, [actions, resizeEnd]);
|
|
164
175
|
var onBlur = (0, _react.useCallback)(function () {
|
|
165
176
|
if (resizeContext.current.trigger === 'key') {
|
|
166
177
|
resizeEnd();
|
|
@@ -219,12 +230,7 @@ var EuiResizableContainer = function EuiResizableContainer(_ref) {
|
|
|
219
230
|
}, (0, _react2.jsx)("div", (0, _extends2.default)({
|
|
220
231
|
css: cssStyles,
|
|
221
232
|
className: classes,
|
|
222
|
-
ref: containerRef
|
|
223
|
-
onMouseMove: reducerState.isDragging ? onMouseMove : undefined,
|
|
224
|
-
onMouseUp: onMouseUp,
|
|
225
|
-
onMouseLeave: onMouseUp,
|
|
226
|
-
onTouchMove: onMouseMove,
|
|
227
|
-
onTouchEnd: onMouseUp
|
|
233
|
+
ref: containerRef
|
|
228
234
|
}, rest), render()));
|
|
229
235
|
};
|
|
230
236
|
exports.EuiResizableContainer = EuiResizableContainer;
|