@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
|
@@ -31,7 +31,7 @@ var _focus_utils = require("./focus_utils");
|
|
|
31
31
|
var _data_grid_cell = require("./data_grid_cell.styles");
|
|
32
32
|
var _react2 = require("@emotion/react");
|
|
33
33
|
var _excluded = ["renderCellValue", "cellContext", "column", "setCellContentsRef", "rowIndex", "colIndex", "rowHeightsOptions", "rowHeightUtils", "isControlColumn"],
|
|
34
|
-
_excluded2 = ["width", "popoverContext", "interactiveCellId", "columnType", "className", "column", "style", "rowHeightUtils", "rowHeightsOptions", "rowManager", "pagination"],
|
|
34
|
+
_excluded2 = ["width", "popoverContext", "interactiveCellId", "columnType", "className", "column", "style", "rowHeightUtils", "rowHeightsOptions", "rowManager", "pagination", "isLastCopyColumn"],
|
|
35
35
|
_excluded3 = ["isExpandable", "style", "className", "data-test-subj"],
|
|
36
36
|
_excluded4 = ["columnId", "columnIndex", "rowIndex", "visibleRowIndex"];
|
|
37
37
|
/*
|
|
@@ -425,6 +425,8 @@ var EuiDataGridCell = exports.EuiDataGridCell = /*#__PURE__*/function (_Componen
|
|
|
425
425
|
rowHeightsOptions = _this$props9.rowHeightsOptions,
|
|
426
426
|
rowManager = _this$props9.rowManager,
|
|
427
427
|
pagination = _this$props9.pagination,
|
|
428
|
+
_this$props9$isLastCo = _this$props9.isLastCopyColumn,
|
|
429
|
+
isLastCopyColumn = _this$props9$isLastCo === void 0 ? false : _this$props9$isLastCo,
|
|
428
430
|
rest = (0, _objectWithoutProperties2.default)(_this$props9, _excluded2);
|
|
429
431
|
var rowIndex = rest.rowIndex,
|
|
430
432
|
visibleRowIndex = rest.visibleRowIndex,
|
|
@@ -436,7 +438,6 @@ var EuiDataGridCell = exports.EuiDataGridCell = /*#__PURE__*/function (_Componen
|
|
|
436
438
|
|
|
437
439
|
// classNames set by EuiDataGridCellWrapper
|
|
438
440
|
var isControlColumn = cellClasses.includes('euiDataGridRowCell--controlColumn');
|
|
439
|
-
var isLastColumn = cellClasses.includes('euiDataGridRowCell--lastColumn');
|
|
440
441
|
var ariaRowIndex = pagination ? visibleRowIndex + 1 + pagination.pageSize * pagination.pageIndex : visibleRowIndex + 1;
|
|
441
442
|
var _this$state$cellProps2 = this.state.cellProps,
|
|
442
443
|
_ = _this$state$cellProps2.isExpandable,
|
|
@@ -476,7 +477,7 @@ var EuiDataGridCell = exports.EuiDataGridCell = /*#__PURE__*/function (_Componen
|
|
|
476
477
|
onKeyDown: this.handleCellKeyDown,
|
|
477
478
|
onMouseEnter: this.onMouseEnter,
|
|
478
479
|
onMouseLeave: this.onMouseLeave
|
|
479
|
-
}), (0, _react2.jsx)(_focus_utils.HandleInteractiveChildren, {
|
|
480
|
+
}), isControlColumn && _services.tabularCopyMarkers.hiddenNoCopyBoundary, (0, _react2.jsx)(_focus_utils.HandleInteractiveChildren, {
|
|
480
481
|
cellEl: this.cellRef.current,
|
|
481
482
|
updateCellFocusContext: this.updateCellFocusContext,
|
|
482
483
|
renderFocusTrap: !isExpandable
|
|
@@ -492,7 +493,7 @@ var EuiDataGridCell = exports.EuiDataGridCell = /*#__PURE__*/function (_Componen
|
|
|
492
493
|
isControlColumn: isControlColumn,
|
|
493
494
|
rowIndex: rowIndex,
|
|
494
495
|
colIndex: colIndex
|
|
495
|
-
}))),
|
|
496
|
+
}))), isControlColumn ? _services.tabularCopyMarkers.hiddenNoCopyBoundary : isLastCopyColumn ? _services.tabularCopyMarkers.hiddenNewline : _services.tabularCopyMarkers.hiddenTab, this.state.isFocused && (0, _react2.jsx)(CellScreenReaderDescription, {
|
|
496
497
|
columnName: (column === null || column === void 0 ? void 0 : column.displayAsText) || this.props.columnId,
|
|
497
498
|
columnIndex: colIndex + 1,
|
|
498
499
|
rowIndex: ariaRowIndex,
|
|
@@ -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 _services = require("../../../../services");
|
|
17
12
|
var _global_styling = require("../../../../global_styling");
|
|
@@ -20,84 +15,79 @@ var _column_resizer = require("./column_resizer.styles");
|
|
|
20
15
|
var _react2 = require("@emotion/react");
|
|
21
16
|
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); }
|
|
22
17
|
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; }
|
|
23
|
-
|
|
24
|
-
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } /*
|
|
18
|
+
/*
|
|
25
19
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
26
20
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
27
21
|
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
28
22
|
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
29
23
|
* Side Public License, v 1.
|
|
30
24
|
*/
|
|
25
|
+
|
|
31
26
|
var MINIMUM_COLUMN_WIDTH = 40;
|
|
32
|
-
var EuiDataGridColumnResizer = exports.EuiDataGridColumnResizer =
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
27
|
+
var EuiDataGridColumnResizer = exports.EuiDataGridColumnResizer = function EuiDataGridColumnResizer(_ref) {
|
|
28
|
+
var columnId = _ref.columnId,
|
|
29
|
+
columnWidth = _ref.columnWidth,
|
|
30
|
+
setColumnWidth = _ref.setColumnWidth,
|
|
31
|
+
isLastColumn = _ref.isLastColumn;
|
|
32
|
+
var styles = (0, _services.useEuiMemoizedStyles)(_column_resizer.euiDataGridColumnResizerStyles);
|
|
33
|
+
var _useState = (0, _react.useState)(0),
|
|
34
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
35
|
+
offset = _useState2[0],
|
|
36
|
+
setOffset = _useState2[1];
|
|
37
|
+
var initialX = (0, _react.useRef)(0);
|
|
38
|
+
|
|
39
|
+
// Handlers are bound to `window`, so they must stay stable to be removed
|
|
40
|
+
// and read current values from a ref
|
|
41
|
+
var latest = (0, _services.useLatest)({
|
|
42
|
+
columnId: columnId,
|
|
43
|
+
columnWidth: columnWidth,
|
|
44
|
+
setColumnWidth: setColumnWidth,
|
|
45
|
+
offset: offset
|
|
46
|
+
});
|
|
47
|
+
var onMouseMove = (0, _react.useCallback)(function (e) {
|
|
48
|
+
var _ref2 = latest.current,
|
|
49
|
+
columnWidth = _ref2.columnWidth;
|
|
50
|
+
setOffset(Math.max(e.pageX - initialX.current, -(columnWidth - MINIMUM_COLUMN_WIDTH)));
|
|
51
|
+
}, [latest]);
|
|
52
|
+
var onMouseUp = (0, _react.useCallback)(function () {
|
|
53
|
+
var _ref3 = latest.current,
|
|
54
|
+
columnId = _ref3.columnId,
|
|
55
|
+
columnWidth = _ref3.columnWidth,
|
|
56
|
+
setColumnWidth = _ref3.setColumnWidth,
|
|
57
|
+
offset = _ref3.offset;
|
|
58
|
+
setColumnWidth(columnId, Math.max(MINIMUM_COLUMN_WIDTH, columnWidth + offset));
|
|
59
|
+
setOffset(0);
|
|
60
|
+
window.removeEventListener('mouseup', onMouseUp);
|
|
61
|
+
window.removeEventListener('blur', onMouseUp);
|
|
62
|
+
window.removeEventListener('mousemove', onMouseMove);
|
|
63
|
+
}, [latest, onMouseMove]);
|
|
64
|
+
var onMouseDown = (0, _react.useCallback)(function (e) {
|
|
65
|
+
initialX.current = e.pageX;
|
|
66
|
+
window.addEventListener('mouseup', onMouseUp);
|
|
67
|
+
window.addEventListener('blur', onMouseUp);
|
|
68
|
+
window.addEventListener('mousemove', onMouseMove);
|
|
69
|
+
|
|
70
|
+
// don't let this action steal focus
|
|
71
|
+
e.preventDefault();
|
|
72
|
+
}, [onMouseUp, onMouseMove]);
|
|
51
73
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
var initialX = _ref.initialX;
|
|
73
|
-
return {
|
|
74
|
-
offset: Math.max(e.pageX - initialX, -(columnWidth - MINIMUM_COLUMN_WIDTH))
|
|
75
|
-
};
|
|
76
|
-
});
|
|
77
|
-
});
|
|
78
|
-
return _this;
|
|
79
|
-
}
|
|
80
|
-
(0, _inherits2.default)(EuiDataGridColumnResizer, _Component);
|
|
81
|
-
return (0, _createClass2.default)(EuiDataGridColumnResizer, [{
|
|
82
|
-
key: "render",
|
|
83
|
-
value: function render() {
|
|
84
|
-
var _this2 = this;
|
|
85
|
-
var offset = this.state.offset;
|
|
86
|
-
var isLastColumn = this.props.isLastColumn;
|
|
87
|
-
return (0, _react2.jsx)(_services.RenderWithEuiStylesMemoizer, null, function (stylesMemoizer) {
|
|
88
|
-
var styles = stylesMemoizer(_column_resizer.euiDataGridColumnResizerStyles);
|
|
89
|
-
var cssStyles = [styles.euiDataGridColumnResizer, isLastColumn && styles.isLastColumn, offset && styles.isDragging];
|
|
90
|
-
return (0, _react2.jsx)("div", {
|
|
91
|
-
css: cssStyles,
|
|
92
|
-
className: "euiDataGridColumnResizer",
|
|
93
|
-
"data-test-subj": "dataGridColumnResizer",
|
|
94
|
-
style: offset ? (0, _global_styling.logicalStyle)('margin-right', "".concat(-offset, "px")) : undefined,
|
|
95
|
-
onMouseDown: _this2.onMouseDown
|
|
96
|
-
}, (0, _react2.jsx)(_draggable_columns.DragOverlay, {
|
|
97
|
-
isDragging: !!offset,
|
|
98
|
-
cursor: "ew-resize"
|
|
99
|
-
}));
|
|
100
|
-
});
|
|
101
|
-
}
|
|
102
|
-
}]);
|
|
103
|
-
}(_react.Component);
|
|
74
|
+
// Clean up listeners if unmounted mid-drag
|
|
75
|
+
(0, _react.useEffect)(function () {
|
|
76
|
+
return function () {
|
|
77
|
+
window.removeEventListener('mouseup', onMouseUp);
|
|
78
|
+
window.removeEventListener('blur', onMouseUp);
|
|
79
|
+
window.removeEventListener('mousemove', onMouseMove);
|
|
80
|
+
};
|
|
81
|
+
}, [onMouseUp, onMouseMove]);
|
|
82
|
+
var cssStyles = [styles.euiDataGridColumnResizer, isLastColumn && styles.isLastColumn, offset && styles.isDragging];
|
|
83
|
+
return (0, _react2.jsx)("div", {
|
|
84
|
+
css: cssStyles,
|
|
85
|
+
className: "euiDataGridColumnResizer",
|
|
86
|
+
"data-test-subj": "dataGridColumnResizer",
|
|
87
|
+
style: offset ? (0, _global_styling.logicalStyle)('margin-right', "".concat(-offset, "px")) : undefined,
|
|
88
|
+
onMouseDown: onMouseDown
|
|
89
|
+
}, (0, _react2.jsx)(_draggable_columns.DragOverlay, {
|
|
90
|
+
isDragging: !!offset,
|
|
91
|
+
cursor: "ew-resize"
|
|
92
|
+
}));
|
|
93
|
+
};
|
|
@@ -34,7 +34,8 @@ var EuiDataGridControlHeaderCell = exports.EuiDataGridControlHeaderCell = /*#__P
|
|
|
34
34
|
id: id,
|
|
35
35
|
index: index,
|
|
36
36
|
width: width,
|
|
37
|
-
isLastColumn: isLastColumn
|
|
37
|
+
isLastColumn: isLastColumn,
|
|
38
|
+
isControlColumn: true
|
|
38
39
|
}), (0, _react2.jsx)(HeaderCellRender, null));
|
|
39
40
|
});
|
|
40
41
|
EuiDataGridControlHeaderCell.displayName = 'EuiDataGridControlHeaderCell';
|
|
@@ -97,6 +97,7 @@ var EuiDataGridHeaderCell = exports.EuiDataGridHeaderCell = /*#__PURE__*/(0, _re
|
|
|
97
97
|
id: id,
|
|
98
98
|
index: index,
|
|
99
99
|
isLastColumn: isLastColumn,
|
|
100
|
+
isLastCopyColumn: columns.length > 0 ? columns[columns.length - 1].id === id : isLastColumn,
|
|
100
101
|
width: width,
|
|
101
102
|
"aria-sort": ariaSort,
|
|
102
103
|
"aria-labelledby": cellContentId,
|
|
@@ -16,7 +16,7 @@ var _focus = require("../../utils/focus");
|
|
|
16
16
|
var _focus_utils = require("../cell/focus_utils");
|
|
17
17
|
var _data_grid_header_cell_wrapper = require("./data_grid_header_cell_wrapper.styles");
|
|
18
18
|
var _react2 = require("@emotion/react");
|
|
19
|
-
var _excluded = ["id", "index", "isLastColumn", "width", "className", "children", "hasColumnActions", "isDragging", "onKeyDown", "aria-label", "aria-labelledby"];
|
|
19
|
+
var _excluded = ["id", "index", "isLastColumn", "isLastCopyColumn", "isControlColumn", "width", "className", "children", "hasColumnActions", "isDragging", "onKeyDown", "aria-label", "aria-labelledby"];
|
|
20
20
|
/*
|
|
21
21
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
22
22
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
@@ -35,6 +35,10 @@ var EuiDataGridHeaderCellWrapper = exports.EuiDataGridHeaderCellWrapper = functi
|
|
|
35
35
|
var id = _ref.id,
|
|
36
36
|
index = _ref.index,
|
|
37
37
|
isLastColumn = _ref.isLastColumn,
|
|
38
|
+
_ref$isLastCopyColumn = _ref.isLastCopyColumn,
|
|
39
|
+
isLastCopyColumn = _ref$isLastCopyColumn === void 0 ? isLastColumn : _ref$isLastCopyColumn,
|
|
40
|
+
_ref$isControlColumn = _ref.isControlColumn,
|
|
41
|
+
isControlColumn = _ref$isControlColumn === void 0 ? false : _ref$isControlColumn,
|
|
38
42
|
width = _ref.width,
|
|
39
43
|
className = _ref.className,
|
|
40
44
|
children = _ref.children,
|
|
@@ -110,10 +114,10 @@ var EuiDataGridHeaderCellWrapper = exports.EuiDataGridHeaderCellWrapper = functi
|
|
|
110
114
|
} : {},
|
|
111
115
|
"aria-label": renderFocusTrap ? ariaLabel : undefined,
|
|
112
116
|
"aria-labelledby": renderFocusTrap ? ariaLabelledby : undefined
|
|
113
|
-
}, rest), (0, _react2.jsx)(_focus_utils.HandleInteractiveChildren, {
|
|
117
|
+
}, rest), isControlColumn && _services.tabularCopyMarkers.hiddenNoCopyBoundary, (0, _react2.jsx)(_focus_utils.HandleInteractiveChildren, {
|
|
114
118
|
cellEl: isDragging ? null : headerEl,
|
|
115
119
|
renderFocusTrap: isDragging ? false : renderFocusTrap,
|
|
116
120
|
updateCellFocusContext: updateCellFocusContext,
|
|
117
121
|
onInteractiveChildrenFound: setInteractiveChildren
|
|
118
|
-
}, typeof children === 'function' ? children(renderFocusTrap) : children),
|
|
122
|
+
}, typeof children === 'function' ? children(renderFocusTrap) : children), isControlColumn ? _services.tabularCopyMarkers.hiddenNoCopyBoundary : isLastCopyColumn ? _services.tabularCopyMarkers.hiddenNewline : _services.tabularCopyMarkers.hiddenTab);
|
|
119
123
|
};
|
package/optimize/lib/components/datagrid/body/header/data_grid_header_cell_wrapper.styles.js
CHANGED
|
@@ -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,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useCopyFocusedDataGridCell = exports.copyFocusedDataGridCell = void 0;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
/*
|
|
9
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
10
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
11
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
12
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
13
|
+
* Side Public License, v 1.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
/** Copies the focused data cell value when nothing is selected. */
|
|
17
|
+
var copyFocusedDataGridCell = exports.copyFocusedDataGridCell = function copyFocusedDataGridCell(event) {
|
|
18
|
+
var _window$getSelection, _ref, _cellContent$innerTex;
|
|
19
|
+
if (event.defaultPrevented) return;
|
|
20
|
+
var cell = document.activeElement;
|
|
21
|
+
if (!(cell instanceof HTMLElement)) return;
|
|
22
|
+
if (!cell.classList.contains('euiDataGridRowCell')) return;
|
|
23
|
+
if (cell.classList.contains('euiDataGridRowCell--controlColumn')) return;
|
|
24
|
+
if ((_window$getSelection = window.getSelection()) !== null && _window$getSelection !== void 0 && _window$getSelection.toString()) return;
|
|
25
|
+
if (!event.clipboardData) return;
|
|
26
|
+
var cellContent = cell.querySelector('[data-datagrid-cellcontent]');
|
|
27
|
+
var text = (_ref = (_cellContent$innerTex = cellContent === null || cellContent === void 0 ? void 0 : cellContent.innerText) !== null && _cellContent$innerTex !== void 0 ? _cellContent$innerTex : cellContent === null || cellContent === void 0 ? void 0 : cellContent.textContent) !== null && _ref !== void 0 ? _ref : '';
|
|
28
|
+
if (!text) return;
|
|
29
|
+
event.clipboardData.setData('text/plain', text);
|
|
30
|
+
event.preventDefault();
|
|
31
|
+
};
|
|
32
|
+
var useCopyFocusedDataGridCell = exports.useCopyFocusedDataGridCell = function useCopyFocusedDataGridCell() {
|
|
33
|
+
(0, _react.useEffect)(function () {
|
|
34
|
+
// The handler is static, so the browser dedupes identical listeners.
|
|
35
|
+
// Do not remove on unmount — that would disable copy for remaining grids.
|
|
36
|
+
// Same approach as OverrideCopiedTabularContent.
|
|
37
|
+
document.addEventListener('copy', copyFocusedDataGridCell);
|
|
38
|
+
}, []);
|
|
39
|
+
};
|
|
@@ -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');
|