@elastic/eui 121.0.0 → 122.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/eui-icons.json +37 -37
- package/es/components/combo_box/combo_box_options_list/combo_box_options_list.js +8 -2
- package/es/components/datagrid/body/cell/data_grid_cell.js +8 -5
- package/es/components/datagrid/body/cell/data_grid_cell.styles.js +1 -1
- package/es/components/datagrid/body/cell/data_grid_cell_wrapper.js +4 -2
- package/es/components/datagrid/body/footer/data_grid_footer_row.js +4 -0
- package/es/components/datagrid/body/header/column_resizer.js +74 -87
- package/es/components/datagrid/body/header/data_grid_control_header_cell.js +2 -1
- package/es/components/datagrid/body/header/data_grid_header_cell.js +1 -0
- package/es/components/datagrid/body/header/data_grid_header_cell_wrapper.js +9 -3
- package/es/components/datagrid/body/header/data_grid_header_cell_wrapper.styles.js +1 -1
- package/es/components/datagrid/controls/keyboard_shortcuts.js +17 -1
- package/es/components/datagrid/data_grid.js +2 -0
- package/es/components/datagrid/utils/copy_focused_cell.js +34 -0
- package/es/components/filter_group/filter_group.a11y.js +1 -1
- package/es/components/form/super_select/super_select.js +247 -351
- package/es/components/list_item_layout/_list_item_layout.js +12 -0
- package/es/components/selectable/selectable_list/selectable_list_item.js +9 -7
- package/eui.d.ts +69 -95
- package/i18ntokens.json +608 -554
- package/lib/components/combo_box/combo_box_options_list/combo_box_options_list.js +8 -2
- package/lib/components/datagrid/body/cell/data_grid_cell.js +8 -5
- package/lib/components/datagrid/body/cell/data_grid_cell.styles.js +1 -1
- package/lib/components/datagrid/body/cell/data_grid_cell_wrapper.js +4 -2
- package/lib/components/datagrid/body/footer/data_grid_footer_row.js +4 -0
- package/lib/components/datagrid/body/header/column_resizer.js +73 -85
- package/lib/components/datagrid/body/header/data_grid_control_header_cell.js +2 -1
- package/lib/components/datagrid/body/header/data_grid_header_cell.js +1 -0
- package/lib/components/datagrid/body/header/data_grid_header_cell_wrapper.js +9 -3
- package/lib/components/datagrid/body/header/data_grid_header_cell_wrapper.styles.js +1 -1
- package/lib/components/datagrid/controls/keyboard_shortcuts.js +17 -1
- package/lib/components/datagrid/data_grid.js +2 -0
- package/lib/components/datagrid/utils/copy_focused_cell.js +39 -0
- package/lib/components/filter_group/filter_group.a11y.js +1 -1
- package/lib/components/form/super_select/super_select.js +253 -355
- package/lib/components/list_item_layout/_list_item_layout.js +12 -0
- package/lib/components/selectable/selectable_list/selectable_list_item.js +9 -7
- package/optimize/es/components/combo_box/combo_box_options_list/combo_box_options_list.js +8 -2
- package/optimize/es/components/datagrid/body/cell/data_grid_cell.js +5 -4
- package/optimize/es/components/datagrid/body/cell/data_grid_cell.styles.js +1 -1
- package/optimize/es/components/datagrid/body/cell/data_grid_cell_wrapper.js +4 -2
- package/optimize/es/components/datagrid/body/footer/data_grid_footer_row.js +4 -0
- package/optimize/es/components/datagrid/body/header/column_resizer.js +69 -81
- package/optimize/es/components/datagrid/body/header/data_grid_control_header_cell.js +2 -1
- package/optimize/es/components/datagrid/body/header/data_grid_header_cell.js +1 -0
- package/optimize/es/components/datagrid/body/header/data_grid_header_cell_wrapper.js +7 -3
- package/optimize/es/components/datagrid/body/header/data_grid_header_cell_wrapper.styles.js +1 -1
- package/optimize/es/components/datagrid/controls/keyboard_shortcuts.js +17 -1
- package/optimize/es/components/datagrid/data_grid.js +2 -0
- package/optimize/es/components/datagrid/utils/copy_focused_cell.js +34 -0
- package/optimize/es/components/filter_group/filter_group.a11y.js +1 -1
- package/optimize/es/components/form/super_select/super_select.js +242 -265
- package/optimize/es/components/selectable/selectable_list/selectable_list_item.js +9 -7
- package/optimize/lib/components/combo_box/combo_box_options_list/combo_box_options_list.js +8 -2
- package/optimize/lib/components/datagrid/body/cell/data_grid_cell.js +5 -4
- package/optimize/lib/components/datagrid/body/cell/data_grid_cell.styles.js +1 -1
- package/optimize/lib/components/datagrid/body/cell/data_grid_cell_wrapper.js +4 -2
- package/optimize/lib/components/datagrid/body/footer/data_grid_footer_row.js +4 -0
- package/optimize/lib/components/datagrid/body/header/column_resizer.js +69 -79
- package/optimize/lib/components/datagrid/body/header/data_grid_control_header_cell.js +2 -1
- package/optimize/lib/components/datagrid/body/header/data_grid_header_cell.js +1 -0
- package/optimize/lib/components/datagrid/body/header/data_grid_header_cell_wrapper.js +7 -3
- package/optimize/lib/components/datagrid/body/header/data_grid_header_cell_wrapper.styles.js +1 -1
- package/optimize/lib/components/datagrid/controls/keyboard_shortcuts.js +17 -1
- package/optimize/lib/components/datagrid/data_grid.js +2 -0
- package/optimize/lib/components/datagrid/utils/copy_focused_cell.js +39 -0
- package/optimize/lib/components/filter_group/filter_group.a11y.js +1 -1
- package/optimize/lib/components/form/super_select/super_select.js +243 -265
- package/optimize/lib/components/selectable/selectable_list/selectable_list_item.js +9 -7
- package/package.json +2 -2
- package/test-env/components/combo_box/combo_box_options_list/combo_box_options_list.js +8 -2
- package/test-env/components/datagrid/body/cell/data_grid_cell.js +8 -5
- package/test-env/components/datagrid/body/cell/data_grid_cell.styles.js +1 -1
- package/test-env/components/datagrid/body/cell/data_grid_cell_wrapper.js +4 -2
- package/test-env/components/datagrid/body/footer/data_grid_footer_row.js +4 -0
- package/test-env/components/datagrid/body/header/column_resizer.js +69 -79
- package/test-env/components/datagrid/body/header/data_grid_control_header_cell.js +2 -1
- package/test-env/components/datagrid/body/header/data_grid_header_cell.js +1 -0
- package/test-env/components/datagrid/body/header/data_grid_header_cell_wrapper.js +9 -3
- package/test-env/components/datagrid/body/header/data_grid_header_cell_wrapper.styles.js +1 -1
- package/test-env/components/datagrid/controls/keyboard_shortcuts.js +17 -1
- package/test-env/components/datagrid/data_grid.js +2 -0
- package/test-env/components/datagrid/utils/copy_focused_cell.js +16 -0
- package/test-env/components/filter_group/filter_group.a11y.js +1 -1
- package/test-env/components/form/super_select/super_select.js +243 -345
- package/test-env/components/list_item_layout/_list_item_layout.js +12 -0
- package/test-env/components/selectable/selectable_list/selectable_list_item.js +9 -7
|
@@ -32,7 +32,7 @@ var _focus_utils = require("./focus_utils");
|
|
|
32
32
|
var _data_grid_cell = require("./data_grid_cell.styles");
|
|
33
33
|
var _react2 = require("@emotion/react");
|
|
34
34
|
var _excluded = ["renderCellValue", "cellContext", "column", "setCellContentsRef", "rowIndex", "colIndex", "rowHeightsOptions", "rowHeightUtils", "isControlColumn"],
|
|
35
|
-
_excluded2 = ["width", "popoverContext", "interactiveCellId", "columnType", "className", "column", "style", "rowHeightUtils", "rowHeightsOptions", "rowManager", "pagination"],
|
|
35
|
+
_excluded2 = ["width", "popoverContext", "interactiveCellId", "columnType", "className", "column", "style", "rowHeightUtils", "rowHeightsOptions", "rowManager", "pagination", "isLastCopyColumn"],
|
|
36
36
|
_excluded3 = ["isExpandable", "style", "className", "data-test-subj"],
|
|
37
37
|
_excluded4 = ["columnId", "columnIndex", "rowIndex", "visibleRowIndex"];
|
|
38
38
|
/*
|
|
@@ -657,6 +657,7 @@ EuiDataGridCellContent.propTypes = {
|
|
|
657
657
|
*/
|
|
658
658
|
onChange: _propTypes.default.func
|
|
659
659
|
}).isRequired,
|
|
660
|
+
isLastCopyColumn: _propTypes.default.bool,
|
|
660
661
|
setCellProps: _propTypes.default.func.isRequired,
|
|
661
662
|
setCellContentsRef: _propTypes.default.func.isRequired,
|
|
662
663
|
isExpanded: _propTypes.default.bool.isRequired,
|
|
@@ -996,6 +997,8 @@ var EuiDataGridCell = exports.EuiDataGridCell = /*#__PURE__*/function (_Componen
|
|
|
996
997
|
rowHeightsOptions = _this$props9.rowHeightsOptions,
|
|
997
998
|
rowManager = _this$props9.rowManager,
|
|
998
999
|
pagination = _this$props9.pagination,
|
|
1000
|
+
_this$props9$isLastCo = _this$props9.isLastCopyColumn,
|
|
1001
|
+
isLastCopyColumn = _this$props9$isLastCo === void 0 ? false : _this$props9$isLastCo,
|
|
999
1002
|
rest = (0, _objectWithoutProperties2.default)(_this$props9, _excluded2);
|
|
1000
1003
|
var rowIndex = rest.rowIndex,
|
|
1001
1004
|
visibleRowIndex = rest.visibleRowIndex,
|
|
@@ -1007,7 +1010,6 @@ var EuiDataGridCell = exports.EuiDataGridCell = /*#__PURE__*/function (_Componen
|
|
|
1007
1010
|
|
|
1008
1011
|
// classNames set by EuiDataGridCellWrapper
|
|
1009
1012
|
var isControlColumn = cellClasses.includes('euiDataGridRowCell--controlColumn');
|
|
1010
|
-
var isLastColumn = cellClasses.includes('euiDataGridRowCell--lastColumn');
|
|
1011
1013
|
var ariaRowIndex = pagination ? visibleRowIndex + 1 + pagination.pageSize * pagination.pageIndex : visibleRowIndex + 1;
|
|
1012
1014
|
var _this$state$cellProps2 = this.state.cellProps,
|
|
1013
1015
|
_ = _this$state$cellProps2.isExpandable,
|
|
@@ -1047,7 +1049,7 @@ var EuiDataGridCell = exports.EuiDataGridCell = /*#__PURE__*/function (_Componen
|
|
|
1047
1049
|
onKeyDown: this.handleCellKeyDown,
|
|
1048
1050
|
onMouseEnter: this.onMouseEnter,
|
|
1049
1051
|
onMouseLeave: this.onMouseLeave
|
|
1050
|
-
}), (0, _react2.jsx)(_focus_utils.HandleInteractiveChildren, {
|
|
1052
|
+
}), isControlColumn && _services.tabularCopyMarkers.hiddenNoCopyBoundary, (0, _react2.jsx)(_focus_utils.HandleInteractiveChildren, {
|
|
1051
1053
|
cellEl: this.cellRef.current,
|
|
1052
1054
|
updateCellFocusContext: this.updateCellFocusContext,
|
|
1053
1055
|
renderFocusTrap: !isExpandable
|
|
@@ -1063,7 +1065,7 @@ var EuiDataGridCell = exports.EuiDataGridCell = /*#__PURE__*/function (_Componen
|
|
|
1063
1065
|
isControlColumn: isControlColumn,
|
|
1064
1066
|
rowIndex: rowIndex,
|
|
1065
1067
|
colIndex: colIndex
|
|
1066
|
-
}))),
|
|
1068
|
+
}))), isControlColumn ? _services.tabularCopyMarkers.hiddenNoCopyBoundary : isLastCopyColumn ? _services.tabularCopyMarkers.hiddenNewline : _services.tabularCopyMarkers.hiddenTab, this.state.isFocused && (0, _react2.jsx)(CellScreenReaderDescription, {
|
|
1067
1069
|
columnName: (column === null || column === void 0 ? void 0 : column.displayAsText) || this.props.columnId,
|
|
1068
1070
|
columnIndex: colIndex + 1,
|
|
1069
1071
|
rowIndex: ariaRowIndex,
|
|
@@ -1553,7 +1555,8 @@ EuiDataGridCell.propTypes = {
|
|
|
1553
1555
|
* Can be used for, e.g. storing user `gridStyle` in a local storage object.
|
|
1554
1556
|
*/
|
|
1555
1557
|
onChange: _propTypes.default.func
|
|
1556
|
-
}).isRequired
|
|
1558
|
+
}).isRequired,
|
|
1559
|
+
isLastCopyColumn: _propTypes.default.bool
|
|
1557
1560
|
};
|
|
1558
1561
|
var RenderCellInRow = /*#__PURE__*/(0, _react.memo)(function (_ref2) {
|
|
1559
1562
|
var row = _ref2.row,
|
|
@@ -108,7 +108,7 @@ var euiDataGridRowCellStyles = exports.euiDataGridRowCellStyles = function euiDa
|
|
|
108
108
|
var _euiDataGridCellOutli = euiDataGridCellOutlineSelectors(),
|
|
109
109
|
outlineSelectors = _euiDataGridCellOutli.outline;
|
|
110
110
|
return {
|
|
111
|
-
euiDataGridRowCell: /*#__PURE__*/(0, _react.css)("position:relative;", outlineSelectors.show, "{", cellOutline.focusStyles, ";}", outlineSelectors.hover, "{", cellOutline.hoverStyles, ";}", outlineSelectors.focusTrapped, "{", cellOutline.hoverStyles, ";}&>[data-focus-lock-disabled]{", (0, _global_styling.logicalCSS)('height', '100%'), ";}&:where(.euiDataGridRowCell--numeric, .euiDataGridRowCell--currency){", (0, _global_styling.logicalTextAlignCSS)('right'), ";}&:where(.euiDataGridRowCell--uppercase){text-transform:uppercase;}&:where(.euiDataGridRowCell--lowercase){text-transform:lowercase;}&:where(.euiDataGridRowCell--capitalize){text-transform:capitalize;};label:euiDataGridRowCell;"),
|
|
111
|
+
euiDataGridRowCell: /*#__PURE__*/(0, _react.css)("position:relative;", outlineSelectors.show, "{", cellOutline.focusStyles, ";}", outlineSelectors.hover, "{", cellOutline.hoverStyles, ";}", outlineSelectors.focusTrapped, "{", cellOutline.hoverStyles, ";}&>[data-focus-lock-disabled]{", (0, _global_styling.logicalCSS)('height', '100%'), ";}&:where(.euiDataGridRowCell--numeric, .euiDataGridRowCell--currency){", (0, _global_styling.logicalTextAlignCSS)('right'), ";}&:where(.euiDataGridRowCell--uppercase){text-transform:uppercase;}&:where(.euiDataGridRowCell--lowercase){text-transform:lowercase;}&:where(.euiDataGridRowCell--capitalize){text-transform:capitalize;}&:where(.euiDataGridRowCell--controlColumn){user-select:none;};label:euiDataGridRowCell;"),
|
|
112
112
|
content: {
|
|
113
113
|
euiDataGridRowCell__content: _ref,
|
|
114
114
|
autoHeight: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('height', 'auto'), ";;label:autoHeight;"),
|
|
@@ -57,6 +57,7 @@ var CellWrapper = exports.CellWrapper = /*#__PURE__*/(0, _react.memo)(function (
|
|
|
57
57
|
getCorrectRowIndex = _useContext.getCorrectRowIndex;
|
|
58
58
|
var isFirstColumn = colIndex === 0;
|
|
59
59
|
var isLastColumn = colIndex === visibleColCount - 1;
|
|
60
|
+
var isLastCopyColumn = columns.length > 0 && colIndex === leadingControlColumns.length + columns.length - 1;
|
|
60
61
|
var isLeadingControlColumn = colIndex < leadingControlColumns.length;
|
|
61
62
|
var isTrailingControlColumn = colIndex >= leadingControlColumns.length + columns.length;
|
|
62
63
|
var datacolIndex = colIndex - leadingControlColumns.length;
|
|
@@ -87,9 +88,10 @@ var CellWrapper = exports.CellWrapper = /*#__PURE__*/(0, _react.memo)(function (
|
|
|
87
88
|
rowManager: rowManager,
|
|
88
89
|
popoverContext: popoverContext,
|
|
89
90
|
pagination: pagination,
|
|
90
|
-
cellContext: cellContext
|
|
91
|
+
cellContext: cellContext,
|
|
92
|
+
isLastCopyColumn: isLastCopyColumn
|
|
91
93
|
};
|
|
92
|
-
}, [colIndex, setRowHeight, visibleRowIndex, getCorrectRowIndex, interactiveCellId, style, rowHeightsOptions, rowHeightUtils, rowManager, popoverContext, pagination, cellContext, isFirstColumn, isLastColumn, isLeadingControlColumn, isTrailingControlColumn, textTransform]);
|
|
94
|
+
}, [colIndex, setRowHeight, visibleRowIndex, getCorrectRowIndex, interactiveCellId, style, rowHeightsOptions, rowHeightUtils, rowManager, popoverContext, pagination, cellContext, isFirstColumn, isLastColumn, isLastCopyColumn, isLeadingControlColumn, isTrailingControlColumn, textTransform]);
|
|
93
95
|
if (isLeadingControlColumn) {
|
|
94
96
|
var leadingColumn = leadingControlColumns[colIndex];
|
|
95
97
|
var id = leadingColumn.id,
|
|
@@ -49,6 +49,7 @@ var EuiDataGridFooterRow = exports.EuiDataGridFooterRow = /*#__PURE__*/(0, _reac
|
|
|
49
49
|
var cssStyles = [styles.euiDataGridFooter, gridStyles.stickyFooter && styles.sticky, gridStyles.footer === 'striped' ? visibleRowIndex % 2 !== 0 && styles.striped : styles[gridStyles.footer]];
|
|
50
50
|
var classes = (0, _classnames.default)('euiDataGridFooter', className);
|
|
51
51
|
var dataTestSubj = (0, _classnames.default)('dataGridRow', 'dataGridFooterRow', _dataTestSubj);
|
|
52
|
+
var lastCopyColumnIndex = columns.length > 0 ? leadingControlColumns.length + columns.length - 1 : -1;
|
|
52
53
|
var getCellClasses = (0, _react.useCallback)(function (columnIndex, classes) {
|
|
53
54
|
return (0, _classnames.default)('euiDataGridFooterCell', {
|
|
54
55
|
'euiDataGridRowCell--firstColumn': columnIndex === 0,
|
|
@@ -82,6 +83,7 @@ var EuiDataGridFooterRow = exports.EuiDataGridFooterRow = /*#__PURE__*/(0, _reac
|
|
|
82
83
|
width: width,
|
|
83
84
|
renderCellValue: footerCellRender !== null && footerCellRender !== void 0 ? footerCellRender : renderEmpty,
|
|
84
85
|
isExpandable: false,
|
|
86
|
+
isLastCopyColumn: i === lastCopyColumnIndex,
|
|
85
87
|
className: getCellClasses(i, (0, _classnames.default)('euiDataGridRowCell--controlColumn', footerCellProps === null || footerCellProps === void 0 ? void 0 : footerCellProps.className))
|
|
86
88
|
}));
|
|
87
89
|
}), columns.map(function (_ref3, i) {
|
|
@@ -99,6 +101,7 @@ var EuiDataGridFooterRow = exports.EuiDataGridFooterRow = /*#__PURE__*/(0, _reac
|
|
|
99
101
|
renderCellValue: renderCellValue,
|
|
100
102
|
renderCellPopover: renderCellPopover,
|
|
101
103
|
isExpandable: true,
|
|
104
|
+
isLastCopyColumn: columnPosition === lastCopyColumnIndex,
|
|
102
105
|
className: getCellClasses(columnPosition)
|
|
103
106
|
}));
|
|
104
107
|
}), trailingControlColumns.map(function (_ref4, i) {
|
|
@@ -114,6 +117,7 @@ var EuiDataGridFooterRow = exports.EuiDataGridFooterRow = /*#__PURE__*/(0, _reac
|
|
|
114
117
|
width: width,
|
|
115
118
|
renderCellValue: footerCellRender !== null && footerCellRender !== void 0 ? footerCellRender : renderEmpty,
|
|
116
119
|
isExpandable: false,
|
|
120
|
+
isLastCopyColumn: colIndex === lastCopyColumnIndex,
|
|
117
121
|
className: getCellClasses(colIndex, (0, _classnames.default)('euiDataGridRowCell--controlColumn', footerCellProps === null || footerCellProps === void 0 ? void 0 : footerCellProps.className))
|
|
118
122
|
}));
|
|
119
123
|
}));
|
|
@@ -6,12 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
8
|
exports.EuiDataGridColumnResizer = void 0;
|
|
9
|
-
var
|
|
10
|
-
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
11
|
-
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
12
|
-
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
13
|
-
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
14
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
15
10
|
var _react = _interopRequireWildcard(require("react"));
|
|
16
11
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
17
12
|
var _services = require("../../../../services");
|
|
@@ -21,87 +16,82 @@ var _column_resizer = require("./column_resizer.styles");
|
|
|
21
16
|
var _react2 = require("@emotion/react");
|
|
22
17
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
23
18
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
24
|
-
|
|
25
|
-
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } /*
|
|
19
|
+
/*
|
|
26
20
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
27
21
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
28
22
|
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
29
23
|
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
30
24
|
* Side Public License, v 1.
|
|
31
25
|
*/
|
|
26
|
+
|
|
32
27
|
var MINIMUM_COLUMN_WIDTH = 40;
|
|
33
|
-
var EuiDataGridColumnResizer = exports.EuiDataGridColumnResizer =
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
28
|
+
var EuiDataGridColumnResizer = exports.EuiDataGridColumnResizer = function EuiDataGridColumnResizer(_ref) {
|
|
29
|
+
var columnId = _ref.columnId,
|
|
30
|
+
columnWidth = _ref.columnWidth,
|
|
31
|
+
setColumnWidth = _ref.setColumnWidth,
|
|
32
|
+
isLastColumn = _ref.isLastColumn;
|
|
33
|
+
var styles = (0, _services.useEuiMemoizedStyles)(_column_resizer.euiDataGridColumnResizerStyles);
|
|
34
|
+
var _useState = (0, _react.useState)(0),
|
|
35
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
36
|
+
offset = _useState2[0],
|
|
37
|
+
setOffset = _useState2[1];
|
|
38
|
+
var initialX = (0, _react.useRef)(0);
|
|
39
|
+
|
|
40
|
+
// Handlers are bound to `window`, so they must stay stable to be removed
|
|
41
|
+
// and read current values from a ref
|
|
42
|
+
var latest = (0, _services.useLatest)({
|
|
43
|
+
columnId: columnId,
|
|
44
|
+
columnWidth: columnWidth,
|
|
45
|
+
setColumnWidth: setColumnWidth,
|
|
46
|
+
offset: offset
|
|
47
|
+
});
|
|
48
|
+
var onMouseMove = (0, _react.useCallback)(function (e) {
|
|
49
|
+
var _ref2 = latest.current,
|
|
50
|
+
columnWidth = _ref2.columnWidth;
|
|
51
|
+
setOffset(Math.max(e.pageX - initialX.current, -(columnWidth - MINIMUM_COLUMN_WIDTH)));
|
|
52
|
+
}, [latest]);
|
|
53
|
+
var onMouseUp = (0, _react.useCallback)(function () {
|
|
54
|
+
var _ref3 = latest.current,
|
|
55
|
+
columnId = _ref3.columnId,
|
|
56
|
+
columnWidth = _ref3.columnWidth,
|
|
57
|
+
setColumnWidth = _ref3.setColumnWidth,
|
|
58
|
+
offset = _ref3.offset;
|
|
59
|
+
setColumnWidth(columnId, Math.max(MINIMUM_COLUMN_WIDTH, columnWidth + offset));
|
|
60
|
+
setOffset(0);
|
|
61
|
+
window.removeEventListener('mouseup', onMouseUp);
|
|
62
|
+
window.removeEventListener('blur', onMouseUp);
|
|
63
|
+
window.removeEventListener('mousemove', onMouseMove);
|
|
64
|
+
}, [latest, onMouseMove]);
|
|
65
|
+
var onMouseDown = (0, _react.useCallback)(function (e) {
|
|
66
|
+
initialX.current = e.pageX;
|
|
67
|
+
window.addEventListener('mouseup', onMouseUp);
|
|
68
|
+
window.addEventListener('blur', onMouseUp);
|
|
69
|
+
window.addEventListener('mousemove', onMouseMove);
|
|
70
|
+
|
|
71
|
+
// don't let this action steal focus
|
|
72
|
+
e.preventDefault();
|
|
73
|
+
}, [onMouseUp, onMouseMove]);
|
|
52
74
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
var initialX = _ref.initialX;
|
|
74
|
-
return {
|
|
75
|
-
offset: Math.max(e.pageX - initialX, -(columnWidth - MINIMUM_COLUMN_WIDTH))
|
|
76
|
-
};
|
|
77
|
-
});
|
|
78
|
-
});
|
|
79
|
-
return _this;
|
|
80
|
-
}
|
|
81
|
-
(0, _inherits2.default)(EuiDataGridColumnResizer, _Component);
|
|
82
|
-
return (0, _createClass2.default)(EuiDataGridColumnResizer, [{
|
|
83
|
-
key: "render",
|
|
84
|
-
value: function render() {
|
|
85
|
-
var _this2 = this;
|
|
86
|
-
var offset = this.state.offset;
|
|
87
|
-
var isLastColumn = this.props.isLastColumn;
|
|
88
|
-
return (0, _react2.jsx)(_services.RenderWithEuiStylesMemoizer, null, function (stylesMemoizer) {
|
|
89
|
-
var styles = stylesMemoizer(_column_resizer.euiDataGridColumnResizerStyles);
|
|
90
|
-
var cssStyles = [styles.euiDataGridColumnResizer, isLastColumn && styles.isLastColumn, offset && styles.isDragging];
|
|
91
|
-
return (0, _react2.jsx)("div", {
|
|
92
|
-
css: cssStyles,
|
|
93
|
-
className: "euiDataGridColumnResizer",
|
|
94
|
-
"data-test-subj": "dataGridColumnResizer",
|
|
95
|
-
style: offset ? (0, _global_styling.logicalStyle)('margin-right', "".concat(-offset, "px")) : undefined,
|
|
96
|
-
onMouseDown: _this2.onMouseDown
|
|
97
|
-
}, (0, _react2.jsx)(_draggable_columns.DragOverlay, {
|
|
98
|
-
isDragging: !!offset,
|
|
99
|
-
cursor: "ew-resize"
|
|
100
|
-
}));
|
|
101
|
-
});
|
|
102
|
-
}
|
|
103
|
-
}]);
|
|
104
|
-
}(_react.Component);
|
|
75
|
+
// Clean up listeners if unmounted mid-drag
|
|
76
|
+
(0, _react.useEffect)(function () {
|
|
77
|
+
return function () {
|
|
78
|
+
window.removeEventListener('mouseup', onMouseUp);
|
|
79
|
+
window.removeEventListener('blur', onMouseUp);
|
|
80
|
+
window.removeEventListener('mousemove', onMouseMove);
|
|
81
|
+
};
|
|
82
|
+
}, [onMouseUp, onMouseMove]);
|
|
83
|
+
var cssStyles = [styles.euiDataGridColumnResizer, isLastColumn && styles.isLastColumn, offset && styles.isDragging];
|
|
84
|
+
return (0, _react2.jsx)("div", {
|
|
85
|
+
css: cssStyles,
|
|
86
|
+
className: "euiDataGridColumnResizer",
|
|
87
|
+
"data-test-subj": "dataGridColumnResizer",
|
|
88
|
+
style: offset ? (0, _global_styling.logicalStyle)('margin-right', "".concat(-offset, "px")) : undefined,
|
|
89
|
+
onMouseDown: onMouseDown
|
|
90
|
+
}, (0, _react2.jsx)(_draggable_columns.DragOverlay, {
|
|
91
|
+
isDragging: !!offset,
|
|
92
|
+
cursor: "ew-resize"
|
|
93
|
+
}));
|
|
94
|
+
};
|
|
105
95
|
EuiDataGridColumnResizer.propTypes = {
|
|
106
96
|
columnId: _propTypes.default.string.isRequired,
|
|
107
97
|
columnWidth: _propTypes.default.number.isRequired,
|
|
@@ -35,7 +35,8 @@ var EuiDataGridControlHeaderCell = exports.EuiDataGridControlHeaderCell = /*#__P
|
|
|
35
35
|
id: id,
|
|
36
36
|
index: index,
|
|
37
37
|
width: width,
|
|
38
|
-
isLastColumn: isLastColumn
|
|
38
|
+
isLastColumn: isLastColumn,
|
|
39
|
+
isControlColumn: true
|
|
39
40
|
}), (0, _react2.jsx)(HeaderCellRender, null));
|
|
40
41
|
});
|
|
41
42
|
EuiDataGridControlHeaderCell.propTypes = {
|
|
@@ -98,6 +98,7 @@ var EuiDataGridHeaderCell = exports.EuiDataGridHeaderCell = /*#__PURE__*/(0, _re
|
|
|
98
98
|
id: id,
|
|
99
99
|
index: index,
|
|
100
100
|
isLastColumn: isLastColumn,
|
|
101
|
+
isLastCopyColumn: columns.length > 0 ? columns[columns.length - 1].id === id : isLastColumn,
|
|
101
102
|
width: width,
|
|
102
103
|
"aria-sort": ariaSort,
|
|
103
104
|
"aria-labelledby": cellContentId,
|
|
@@ -17,7 +17,7 @@ var _focus = require("../../utils/focus");
|
|
|
17
17
|
var _focus_utils = require("../cell/focus_utils");
|
|
18
18
|
var _data_grid_header_cell_wrapper = require("./data_grid_header_cell_wrapper.styles");
|
|
19
19
|
var _react2 = require("@emotion/react");
|
|
20
|
-
var _excluded = ["id", "index", "isLastColumn", "width", "className", "children", "hasColumnActions", "isDragging", "onKeyDown", "aria-label", "aria-labelledby"];
|
|
20
|
+
var _excluded = ["id", "index", "isLastColumn", "isLastCopyColumn", "isControlColumn", "width", "className", "children", "hasColumnActions", "isDragging", "onKeyDown", "aria-label", "aria-labelledby"];
|
|
21
21
|
/*
|
|
22
22
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
23
23
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
@@ -36,6 +36,10 @@ var EuiDataGridHeaderCellWrapper = exports.EuiDataGridHeaderCellWrapper = functi
|
|
|
36
36
|
var id = _ref.id,
|
|
37
37
|
index = _ref.index,
|
|
38
38
|
isLastColumn = _ref.isLastColumn,
|
|
39
|
+
_ref$isLastCopyColumn = _ref.isLastCopyColumn,
|
|
40
|
+
isLastCopyColumn = _ref$isLastCopyColumn === void 0 ? isLastColumn : _ref$isLastCopyColumn,
|
|
41
|
+
_ref$isControlColumn = _ref.isControlColumn,
|
|
42
|
+
isControlColumn = _ref$isControlColumn === void 0 ? false : _ref$isControlColumn,
|
|
39
43
|
width = _ref.width,
|
|
40
44
|
className = _ref.className,
|
|
41
45
|
children = _ref.children,
|
|
@@ -111,18 +115,20 @@ var EuiDataGridHeaderCellWrapper = exports.EuiDataGridHeaderCellWrapper = functi
|
|
|
111
115
|
} : {},
|
|
112
116
|
"aria-label": renderFocusTrap ? ariaLabel : undefined,
|
|
113
117
|
"aria-labelledby": renderFocusTrap ? ariaLabelledby : undefined
|
|
114
|
-
}, rest), (0, _react2.jsx)(_focus_utils.HandleInteractiveChildren, {
|
|
118
|
+
}, rest), isControlColumn && _services.tabularCopyMarkers.hiddenNoCopyBoundary, (0, _react2.jsx)(_focus_utils.HandleInteractiveChildren, {
|
|
115
119
|
cellEl: isDragging ? null : headerEl,
|
|
116
120
|
renderFocusTrap: isDragging ? false : renderFocusTrap,
|
|
117
121
|
updateCellFocusContext: updateCellFocusContext,
|
|
118
122
|
onInteractiveChildrenFound: setInteractiveChildren
|
|
119
|
-
}, typeof children === 'function' ? children(renderFocusTrap) : children),
|
|
123
|
+
}, typeof children === 'function' ? children(renderFocusTrap) : children), isControlColumn ? _services.tabularCopyMarkers.hiddenNoCopyBoundary : isLastCopyColumn ? _services.tabularCopyMarkers.hiddenNewline : _services.tabularCopyMarkers.hiddenTab);
|
|
120
124
|
};
|
|
121
125
|
EuiDataGridHeaderCellWrapper.propTypes = {
|
|
122
126
|
children: _propTypes.default.oneOfType([_propTypes.default.node.isRequired, _propTypes.default.func.isRequired]).isRequired,
|
|
123
127
|
id: _propTypes.default.string.isRequired,
|
|
124
128
|
index: _propTypes.default.number.isRequired,
|
|
125
129
|
isLastColumn: _propTypes.default.bool.isRequired,
|
|
130
|
+
isLastCopyColumn: _propTypes.default.bool,
|
|
131
|
+
isControlColumn: _propTypes.default.bool,
|
|
126
132
|
width: _propTypes.default.oneOfType([_propTypes.default.number.isRequired, _propTypes.default.oneOf([null])]),
|
|
127
133
|
className: _propTypes.default.string,
|
|
128
134
|
"aria-label": _propTypes.default.any,
|
|
@@ -26,6 +26,6 @@ var euiDataGridHeaderCellWrapperStyles = exports.euiDataGridHeaderCellWrapperSty
|
|
|
26
26
|
var _euiDataGridCellOutli2 = (0, _data_grid_cell.euiDataGridCellOutlineSelectors)(),
|
|
27
27
|
outlineSelectors = _euiDataGridCellOutli2.header;
|
|
28
28
|
return {
|
|
29
|
-
euiDataGridHeaderCell: /*#__PURE__*/(0, _react.css)("position:relative;display:flex;align-items:center;flex:0 0 auto;font-weight:", euiTheme.font.weight.bold, ";", outlineSelectors.focus, "{", focusStyles, ";}", outlineSelectors.focusTrapped, "{", hoverStyles, ";}", outlineSelectors.showActions, "{&,&>[data-focus-lock-disabled]{gap:", euiTheme.size.xxs, ";}}&>[data-focus-lock-disabled]{display:flex;align-items:center;", (0, _global_styling.logicalCSS)('width', '100%'), ";};label:euiDataGridHeaderCell;")
|
|
29
|
+
euiDataGridHeaderCell: /*#__PURE__*/(0, _react.css)("position:relative;display:flex;align-items:center;flex:0 0 auto;font-weight:", euiTheme.font.weight.bold, ";", outlineSelectors.focus, "{", focusStyles, ";}", outlineSelectors.focusTrapped, "{", hoverStyles, ";}", outlineSelectors.showActions, "{&,&>[data-focus-lock-disabled]{gap:", euiTheme.size.xxs, ";}}&>[data-focus-lock-disabled]{display:flex;align-items:center;", (0, _global_styling.logicalCSS)('width', '100%'), ";}&:where(.euiDataGridHeaderCell--controlColumn){user-select:none;};label:euiDataGridHeaderCell;")
|
|
30
30
|
};
|
|
31
31
|
};
|
|
@@ -34,6 +34,7 @@ var useDataGridKeyboardShortcuts = exports.useDataGridKeyboardShortcuts = functi
|
|
|
34
34
|
setIsOpen = _useState2[1];
|
|
35
35
|
var title = (0, _i18n.useEuiI18n)('euiKeyboardShortcuts.title', 'Keyboard shortcuts');
|
|
36
36
|
var titleId = (0, _services.useGeneratedHtmlId)();
|
|
37
|
+
var copyModifier = typeof navigator !== 'undefined' && /Mac|iP(hone|od|ad)/.test(navigator.platform) ? 'Cmd' : 'Ctrl';
|
|
37
38
|
var styles = (0, _services.useEuiMemoizedStyles)(_keyboard_shortcuts.euiDataGridKeyboardShortcutsStyles);
|
|
38
39
|
var keyboardShortcuts = (0, _react.useMemo)(function () {
|
|
39
40
|
return (0, _react2.jsx)(_popover.EuiPopover, {
|
|
@@ -185,9 +186,24 @@ var useDataGridKeyboardShortcuts = exports.useDataGridKeyboardShortcuts = functi
|
|
|
185
186
|
token: "euiKeyboardShortcuts.escapeDescription",
|
|
186
187
|
default: "Close cell details and actions"
|
|
187
188
|
})
|
|
189
|
+
}, {
|
|
190
|
+
title: (0, _react2.jsx)(_react.default.Fragment, null, (0, _react2.jsx)("kbd", null, copyModifier === 'Cmd' ? (0, _react2.jsx)(_i18n.EuiI18n, {
|
|
191
|
+
token: "euiKeyboardShortcuts.cmd",
|
|
192
|
+
default: "Cmd"
|
|
193
|
+
}) : (0, _react2.jsx)(_i18n.EuiI18n, {
|
|
194
|
+
token: "euiKeyboardShortcuts.ctrl",
|
|
195
|
+
default: "Ctrl"
|
|
196
|
+
})), ' ', (0, _react2.jsx)("kbd", null, (0, _react2.jsx)(_i18n.EuiI18n, {
|
|
197
|
+
token: "euiKeyboardShortcuts.copyTitle",
|
|
198
|
+
default: "C"
|
|
199
|
+
}))),
|
|
200
|
+
description: (0, _react2.jsx)(_i18n.EuiI18n, {
|
|
201
|
+
token: "euiKeyboardShortcuts.copyDescription",
|
|
202
|
+
default: "Copy the focused cell value"
|
|
203
|
+
})
|
|
188
204
|
}]
|
|
189
205
|
})));
|
|
190
|
-
}, [isOpen, title, titleId, styles]);
|
|
206
|
+
}, [isOpen, title, titleId, styles, copyModifier]);
|
|
191
207
|
return {
|
|
192
208
|
keyboardShortcuts: keyboardShortcuts
|
|
193
209
|
};
|
|
@@ -28,6 +28,7 @@ var _in_memory = require("./utils/in_memory");
|
|
|
28
28
|
var _cell = require("./body/cell");
|
|
29
29
|
var _row_count = require("./utils/row_count");
|
|
30
30
|
var _data_grid_schema = require("./utils/data_grid_schema");
|
|
31
|
+
var _copy_focused_cell = require("./utils/copy_focused_cell");
|
|
31
32
|
var _ref = require("./utils/ref");
|
|
32
33
|
var _data_grid_types = require("./data_grid_types");
|
|
33
34
|
var _data_grid = require("./data_grid.styles");
|
|
@@ -255,6 +256,7 @@ var EuiDataGrid = exports.EuiDataGrid = /*#__PURE__*/(0, _react.memo)( /*#__PURE
|
|
|
255
256
|
var showToolbar = !!toolbarVisibility;
|
|
256
257
|
var _useDataGridKeyboardS = (0, _controls.useDataGridKeyboardShortcuts)(),
|
|
257
258
|
keyboardShortcuts = _useDataGridKeyboardS.keyboardShortcuts;
|
|
259
|
+
(0, _copy_focused_cell.useCopyFocusedDataGridCell)();
|
|
258
260
|
var _useDataGridFullScree = (0, _controls.useDataGridFullScreenSelector)(onFullScreenChange),
|
|
259
261
|
isFullScreen = _useDataGridFullScree.isFullScreen,
|
|
260
262
|
setIsFullScreen = _useDataGridFullScree.setIsFullScreen,
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useCopyFocusedDataGridCell = exports.copyFocusedDataGridCell = void 0;
|
|
7
|
+
/*
|
|
8
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
9
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
10
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
11
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
12
|
+
* Side Public License, v 1.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
var copyFocusedDataGridCell = exports.copyFocusedDataGridCell = function copyFocusedDataGridCell() {};
|
|
16
|
+
var useCopyFocusedDataGridCell = exports.useCopyFocusedDataGridCell = function useCopyFocusedDataGridCell() {};
|
|
@@ -241,7 +241,7 @@ describe('EuiFilterGroup multiselect example', function () {
|
|
|
241
241
|
cy.realPress('Enter');
|
|
242
242
|
cy.get('input[role="combobox"]').then(function ($input) {
|
|
243
243
|
var activeOptionId = $input.attr('aria-activedescendant');
|
|
244
|
-
cy.get("li[id=\"".concat(activeOptionId, "\"]")).find('span.euiSelectableListItem__text').should('have.text', 'Dmitri Shostakovich.
|
|
244
|
+
cy.get("li[id=\"".concat(activeOptionId, "\"]")).find('span.euiSelectableListItem__text').should('have.text', 'Dmitri Shostakovich. To exclude this option, press Enter.');
|
|
245
245
|
});
|
|
246
246
|
cy.realPress('ArrowDown');
|
|
247
247
|
cy.repeatRealPress('Enter');
|