@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
|
@@ -435,6 +435,18 @@ EuiListItemLayout.propTypes = {
|
|
|
435
435
|
"data-test-subj": _propTypes.default.string,
|
|
436
436
|
css: _propTypes.default.any
|
|
437
437
|
}),
|
|
438
|
+
/**
|
|
439
|
+
* Props applied to the label text element.
|
|
440
|
+
*/
|
|
441
|
+
/**
|
|
442
|
+
* Props applied to the label text element.
|
|
443
|
+
*/
|
|
444
|
+
/**
|
|
445
|
+
* Props applied to the label text element.
|
|
446
|
+
*/
|
|
447
|
+
/**
|
|
448
|
+
* Props applied to the label text element.
|
|
449
|
+
*/
|
|
438
450
|
textProps: _propTypes.default.shape({
|
|
439
451
|
className: _propTypes.default.string,
|
|
440
452
|
"aria-label": _propTypes.default.string,
|
|
@@ -13,7 +13,7 @@ var _accessibility = require("../../accessibility");
|
|
|
13
13
|
var _badge = require("../../badge");
|
|
14
14
|
var _list_item_layout = require("../../list_item_layout/_list_item_layout");
|
|
15
15
|
var _react2 = require("@emotion/react");
|
|
16
|
-
var _excluded = ["children", "className", "disabled", "checked", "isFocused", "showIcons", "prepend", "append", "allowExclusions", "singleSelection", "onFocusBadge", "role", "searchable", "toolTipContent", "toolTipProps"],
|
|
16
|
+
var _excluded = ["children", "className", "disabled", "checked", "isFocused", "showIcons", "prepend", "append", "allowExclusions", "singleSelection", "onFocusBadge", "role", "searchable", "toolTipContent", "toolTipProps", "title"],
|
|
17
17
|
_excluded2 = ["children", "className"];
|
|
18
18
|
/*
|
|
19
19
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
@@ -53,6 +53,7 @@ var EuiSelectableListItem = exports.EuiSelectableListItem = function EuiSelectab
|
|
|
53
53
|
searchable = _ref.searchable,
|
|
54
54
|
toolTipContent = _ref.toolTipContent,
|
|
55
55
|
toolTipProps = _ref.toolTipProps,
|
|
56
|
+
title = _ref.title,
|
|
56
57
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
57
58
|
var classes = (0, _classnames.default)('euiSelectableListItem', {
|
|
58
59
|
'euiSelectableListItem-isFocused': isFocused
|
|
@@ -82,10 +83,6 @@ var EuiSelectableListItem = exports.EuiSelectableListItem = function EuiSelectab
|
|
|
82
83
|
var instructions;
|
|
83
84
|
var screenReaderStrings = {
|
|
84
85
|
checked: {
|
|
85
|
-
state: (0, _react2.jsx)(_i18n.EuiI18n, {
|
|
86
|
-
token: "euiSelectableListItem.checkedOption",
|
|
87
|
-
default: "Checked option."
|
|
88
|
-
}),
|
|
89
86
|
instructions: (0, _react2.jsx)(_i18n.EuiI18n, {
|
|
90
87
|
token: "euiSelectableListItem.checkOptionInstructions",
|
|
91
88
|
default: "To check this option, press Enter."
|
|
@@ -128,7 +125,8 @@ var EuiSelectableListItem = exports.EuiSelectableListItem = function EuiSelectab
|
|
|
128
125
|
};
|
|
129
126
|
switch (checked) {
|
|
130
127
|
case 'on':
|
|
131
|
-
state
|
|
128
|
+
// the checked state is already announced natively via `aria-checked`/
|
|
129
|
+
// `aria-selected`; additional state text would duplicate the announcement
|
|
132
130
|
instructions = allowExclusions ? screenReaderStrings.excluded.instructions : searchable ? screenReaderStrings.unchecked.instructions : undefined;
|
|
133
131
|
break;
|
|
134
132
|
case 'off':
|
|
@@ -171,7 +169,11 @@ var EuiSelectableListItem = exports.EuiSelectableListItem = function EuiSelectab
|
|
|
171
169
|
className: 'euiSelectableListItem__content'
|
|
172
170
|
},
|
|
173
171
|
textProps: {
|
|
174
|
-
className: 'euiSelectableListItem__text'
|
|
172
|
+
className: 'euiSelectableListItem__text',
|
|
173
|
+
// `title` must not be set on the option element itself - it would become
|
|
174
|
+
// the option's accessible description, causing screen readers to
|
|
175
|
+
// announce the option name twice
|
|
176
|
+
title: title
|
|
175
177
|
},
|
|
176
178
|
tooltipProps: hasToolTip ? _objectSpread({
|
|
177
179
|
content: toolTipContent,
|
|
@@ -7,7 +7,7 @@ import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
|
7
7
|
import _inherits from "@babel/runtime/helpers/inherits";
|
|
8
8
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
9
9
|
var _excluded = ["children"],
|
|
10
|
-
_excluded2 = ["key", "className", "isGroupLabelOption", "label", "value", "prepend", "append", "truncationProps", "toolTipContent", "toolTipProps"],
|
|
10
|
+
_excluded2 = ["key", "className", "isGroupLabelOption", "label", "value", "prepend", "append", "truncationProps", "toolTipContent", "toolTipProps", "title"],
|
|
11
11
|
_excluded3 = ["data-test-subj", "activeOptionIndex", "areAllOptionsSelected", "customOptionText", "fullWidth", "getSelectedOptionForSearchValue", "isCaseSensitive", "isLoading", "listRef", "matchingOptions", "onCloseList", "onCreateOption", "onOptionClick", "onOptionEnterKey", "onScroll", "options", "renderOption", "rootId", "rowHeight", "scrollToIndex", "searchValue", "selectedOptions", "singleSelection", "delimiter", "onFocusBadge", "truncationProps", "listboxAriaLabel", "setListOptionRefs"];
|
|
12
12
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
13
13
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
@@ -85,6 +85,7 @@ export var EuiComboBoxOptionsList = /*#__PURE__*/function (_Component) {
|
|
|
85
85
|
_truncationProps = option.truncationProps,
|
|
86
86
|
toolTipContent = option.toolTipContent,
|
|
87
87
|
toolTipProps = option.toolTipProps,
|
|
88
|
+
title = option.title,
|
|
88
89
|
rest = _objectWithoutProperties(option, _excluded2);
|
|
89
90
|
var _this$props2 = _this.props,
|
|
90
91
|
options = _this$props2.options,
|
|
@@ -136,7 +137,6 @@ export var EuiComboBoxOptionsList = /*#__PURE__*/function (_Component) {
|
|
|
136
137
|
// loses focus on selecting an option (due to actively removing it from the list)
|
|
137
138
|
,
|
|
138
139
|
id: rootId("_option-".concat(options.indexOf(option))),
|
|
139
|
-
title: hasNativeTruncation && !toolTipContent ? label : undefined,
|
|
140
140
|
key: (_option$key = option.key) !== null && _option$key !== void 0 ? _option$key : option.label,
|
|
141
141
|
prepend: option.prepend,
|
|
142
142
|
append: hasOnFocusBadge ? ___EmotionJSX(React.Fragment, null, option.append, hitEnterBadge) : option.append,
|
|
@@ -156,6 +156,12 @@ export var EuiComboBoxOptionsList = /*#__PURE__*/function (_Component) {
|
|
|
156
156
|
contentProps: {
|
|
157
157
|
className: 'euiComboBoxOption__content'
|
|
158
158
|
},
|
|
159
|
+
textProps: {
|
|
160
|
+
// `title` must not be set on the option element itself - it would
|
|
161
|
+
// become the option's accessible description, causing screen readers
|
|
162
|
+
// to announce the option name twice
|
|
163
|
+
title: title !== null && title !== void 0 ? title : hasNativeTruncation && !toolTipContent ? label : undefined
|
|
164
|
+
},
|
|
159
165
|
onClick: function onClick() {
|
|
160
166
|
if (onOptionClick) {
|
|
161
167
|
onOptionClick(option);
|
|
@@ -8,7 +8,7 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
8
8
|
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
9
9
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
10
10
|
var _excluded = ["renderCellValue", "cellContext", "column", "setCellContentsRef", "rowIndex", "colIndex", "rowHeightsOptions", "rowHeightUtils", "isControlColumn"],
|
|
11
|
-
_excluded2 = ["width", "popoverContext", "interactiveCellId", "columnType", "className", "column", "style", "rowHeightUtils", "rowHeightsOptions", "rowManager", "pagination"],
|
|
11
|
+
_excluded2 = ["width", "popoverContext", "interactiveCellId", "columnType", "className", "column", "style", "rowHeightUtils", "rowHeightsOptions", "rowManager", "pagination", "isLastCopyColumn"],
|
|
12
12
|
_excluded3 = ["isExpandable", "style", "className", "data-test-subj"],
|
|
13
13
|
_excluded4 = ["columnId", "columnIndex", "rowIndex", "visibleRowIndex"];
|
|
14
14
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
@@ -416,6 +416,8 @@ export var EuiDataGridCell = /*#__PURE__*/function (_Component) {
|
|
|
416
416
|
rowHeightsOptions = _this$props9.rowHeightsOptions,
|
|
417
417
|
rowManager = _this$props9.rowManager,
|
|
418
418
|
pagination = _this$props9.pagination,
|
|
419
|
+
_this$props9$isLastCo = _this$props9.isLastCopyColumn,
|
|
420
|
+
isLastCopyColumn = _this$props9$isLastCo === void 0 ? false : _this$props9$isLastCo,
|
|
419
421
|
rest = _objectWithoutProperties(_this$props9, _excluded2);
|
|
420
422
|
var rowIndex = rest.rowIndex,
|
|
421
423
|
visibleRowIndex = rest.visibleRowIndex,
|
|
@@ -427,7 +429,6 @@ export var EuiDataGridCell = /*#__PURE__*/function (_Component) {
|
|
|
427
429
|
|
|
428
430
|
// classNames set by EuiDataGridCellWrapper
|
|
429
431
|
var isControlColumn = cellClasses.includes('euiDataGridRowCell--controlColumn');
|
|
430
|
-
var isLastColumn = cellClasses.includes('euiDataGridRowCell--lastColumn');
|
|
431
432
|
var ariaRowIndex = pagination ? visibleRowIndex + 1 + pagination.pageSize * pagination.pageIndex : visibleRowIndex + 1;
|
|
432
433
|
var _this$state$cellProps2 = this.state.cellProps,
|
|
433
434
|
_ = _this$state$cellProps2.isExpandable,
|
|
@@ -467,7 +468,7 @@ export var EuiDataGridCell = /*#__PURE__*/function (_Component) {
|
|
|
467
468
|
onKeyDown: this.handleCellKeyDown,
|
|
468
469
|
onMouseEnter: this.onMouseEnter,
|
|
469
470
|
onMouseLeave: this.onMouseLeave
|
|
470
|
-
}), ___EmotionJSX(HandleInteractiveChildren, {
|
|
471
|
+
}), isControlColumn && tabularCopyMarkers.hiddenNoCopyBoundary, ___EmotionJSX(HandleInteractiveChildren, {
|
|
471
472
|
cellEl: this.cellRef.current,
|
|
472
473
|
updateCellFocusContext: this.updateCellFocusContext,
|
|
473
474
|
renderFocusTrap: !isExpandable
|
|
@@ -483,7 +484,7 @@ export var EuiDataGridCell = /*#__PURE__*/function (_Component) {
|
|
|
483
484
|
isControlColumn: isControlColumn,
|
|
484
485
|
rowIndex: rowIndex,
|
|
485
486
|
colIndex: colIndex
|
|
486
|
-
}))),
|
|
487
|
+
}))), isControlColumn ? tabularCopyMarkers.hiddenNoCopyBoundary : isLastCopyColumn ? tabularCopyMarkers.hiddenNewline : tabularCopyMarkers.hiddenTab, this.state.isFocused && ___EmotionJSX(CellScreenReaderDescription, {
|
|
487
488
|
columnName: (column === null || column === void 0 ? void 0 : column.displayAsText) || this.props.columnId,
|
|
488
489
|
columnIndex: colIndex + 1,
|
|
489
490
|
rowIndex: ariaRowIndex,
|
|
@@ -104,7 +104,7 @@ export var euiDataGridRowCellStyles = function euiDataGridRowCellStyles(euiTheme
|
|
|
104
104
|
var _euiDataGridCellOutli = euiDataGridCellOutlineSelectors(),
|
|
105
105
|
outlineSelectors = _euiDataGridCellOutli.outline;
|
|
106
106
|
return {
|
|
107
|
-
euiDataGridRowCell: /*#__PURE__*/css("position:relative;", outlineSelectors.show, "{", cellOutline.focusStyles, ";}", outlineSelectors.hover, "{", cellOutline.hoverStyles, ";}", outlineSelectors.focusTrapped, "{", cellOutline.hoverStyles, ";}&>[data-focus-lock-disabled]{", logicalCSS('height', '100%'), ";}&:where(.euiDataGridRowCell--numeric, .euiDataGridRowCell--currency){", logicalTextAlignCSS('right'), ";}&:where(.euiDataGridRowCell--uppercase){text-transform:uppercase;}&:where(.euiDataGridRowCell--lowercase){text-transform:lowercase;}&:where(.euiDataGridRowCell--capitalize){text-transform:capitalize;};label:euiDataGridRowCell;"),
|
|
107
|
+
euiDataGridRowCell: /*#__PURE__*/css("position:relative;", outlineSelectors.show, "{", cellOutline.focusStyles, ";}", outlineSelectors.hover, "{", cellOutline.hoverStyles, ";}", outlineSelectors.focusTrapped, "{", cellOutline.hoverStyles, ";}&>[data-focus-lock-disabled]{", logicalCSS('height', '100%'), ";}&:where(.euiDataGridRowCell--numeric, .euiDataGridRowCell--currency){", 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;"),
|
|
108
108
|
content: {
|
|
109
109
|
euiDataGridRowCell__content: _ref,
|
|
110
110
|
autoHeight: /*#__PURE__*/css(logicalCSS('height', 'auto'), ";;label:autoHeight;"),
|
|
@@ -48,6 +48,7 @@ export var CellWrapper = /*#__PURE__*/memo(function (_ref) {
|
|
|
48
48
|
getCorrectRowIndex = _useContext.getCorrectRowIndex;
|
|
49
49
|
var isFirstColumn = colIndex === 0;
|
|
50
50
|
var isLastColumn = colIndex === visibleColCount - 1;
|
|
51
|
+
var isLastCopyColumn = columns.length > 0 && colIndex === leadingControlColumns.length + columns.length - 1;
|
|
51
52
|
var isLeadingControlColumn = colIndex < leadingControlColumns.length;
|
|
52
53
|
var isTrailingControlColumn = colIndex >= leadingControlColumns.length + columns.length;
|
|
53
54
|
var datacolIndex = colIndex - leadingControlColumns.length;
|
|
@@ -78,9 +79,10 @@ export var CellWrapper = /*#__PURE__*/memo(function (_ref) {
|
|
|
78
79
|
rowManager: rowManager,
|
|
79
80
|
popoverContext: popoverContext,
|
|
80
81
|
pagination: pagination,
|
|
81
|
-
cellContext: cellContext
|
|
82
|
+
cellContext: cellContext,
|
|
83
|
+
isLastCopyColumn: isLastCopyColumn
|
|
82
84
|
};
|
|
83
|
-
}, [colIndex, setRowHeight, visibleRowIndex, getCorrectRowIndex, interactiveCellId, style, rowHeightsOptions, rowHeightUtils, rowManager, popoverContext, pagination, cellContext, isFirstColumn, isLastColumn, isLeadingControlColumn, isTrailingControlColumn, textTransform]);
|
|
85
|
+
}, [colIndex, setRowHeight, visibleRowIndex, getCorrectRowIndex, interactiveCellId, style, rowHeightsOptions, rowHeightUtils, rowManager, popoverContext, pagination, cellContext, isFirstColumn, isLastColumn, isLastCopyColumn, isLeadingControlColumn, isTrailingControlColumn, textTransform]);
|
|
84
86
|
if (isLeadingControlColumn) {
|
|
85
87
|
var leadingColumn = leadingControlColumns[colIndex];
|
|
86
88
|
var id = leadingColumn.id,
|
|
@@ -40,6 +40,7 @@ var EuiDataGridFooterRow = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function (
|
|
|
40
40
|
var cssStyles = [styles.euiDataGridFooter, gridStyles.stickyFooter && styles.sticky, gridStyles.footer === 'striped' ? visibleRowIndex % 2 !== 0 && styles.striped : styles[gridStyles.footer]];
|
|
41
41
|
var classes = classNames('euiDataGridFooter', className);
|
|
42
42
|
var dataTestSubj = classNames('dataGridRow', 'dataGridFooterRow', _dataTestSubj);
|
|
43
|
+
var lastCopyColumnIndex = columns.length > 0 ? leadingControlColumns.length + columns.length - 1 : -1;
|
|
43
44
|
var getCellClasses = useCallback(function (columnIndex, classes) {
|
|
44
45
|
return classNames('euiDataGridFooterCell', {
|
|
45
46
|
'euiDataGridRowCell--firstColumn': columnIndex === 0,
|
|
@@ -73,6 +74,7 @@ var EuiDataGridFooterRow = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function (
|
|
|
73
74
|
width: width,
|
|
74
75
|
renderCellValue: footerCellRender !== null && footerCellRender !== void 0 ? footerCellRender : renderEmpty,
|
|
75
76
|
isExpandable: false,
|
|
77
|
+
isLastCopyColumn: i === lastCopyColumnIndex,
|
|
76
78
|
className: getCellClasses(i, classNames('euiDataGridRowCell--controlColumn', footerCellProps === null || footerCellProps === void 0 ? void 0 : footerCellProps.className))
|
|
77
79
|
}));
|
|
78
80
|
}), columns.map(function (_ref3, i) {
|
|
@@ -90,6 +92,7 @@ var EuiDataGridFooterRow = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function (
|
|
|
90
92
|
renderCellValue: renderCellValue,
|
|
91
93
|
renderCellPopover: renderCellPopover,
|
|
92
94
|
isExpandable: true,
|
|
95
|
+
isLastCopyColumn: columnPosition === lastCopyColumnIndex,
|
|
93
96
|
className: getCellClasses(columnPosition)
|
|
94
97
|
}));
|
|
95
98
|
}), trailingControlColumns.map(function (_ref4, i) {
|
|
@@ -105,6 +108,7 @@ var EuiDataGridFooterRow = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function (
|
|
|
105
108
|
width: width,
|
|
106
109
|
renderCellValue: footerCellRender !== null && footerCellRender !== void 0 ? footerCellRender : renderEmpty,
|
|
107
110
|
isExpandable: false,
|
|
111
|
+
isLastCopyColumn: colIndex === lastCopyColumnIndex,
|
|
108
112
|
className: getCellClasses(colIndex, classNames('euiDataGridRowCell--controlColumn', footerCellProps === null || footerCellProps === void 0 ? void 0 : footerCellProps.className))
|
|
109
113
|
}));
|
|
110
114
|
}));
|
|
@@ -1,11 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import _createClass from "@babel/runtime/helpers/createClass";
|
|
3
|
-
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
4
|
-
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
5
|
-
import _inherits from "@babel/runtime/helpers/inherits";
|
|
6
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
7
|
-
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
8
|
-
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
9
2
|
/*
|
|
10
3
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
11
4
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
@@ -14,82 +7,77 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
|
|
|
14
7
|
* Side Public License, v 1.
|
|
15
8
|
*/
|
|
16
9
|
|
|
17
|
-
import React, {
|
|
18
|
-
import {
|
|
10
|
+
import React, { useCallback, useEffect, useRef, useState } from 'react';
|
|
11
|
+
import { useEuiMemoizedStyles, useLatest } from '../../../../services';
|
|
19
12
|
import { logicalStyle } from '../../../../global_styling';
|
|
20
13
|
import { DragOverlay } from './draggable_columns';
|
|
21
14
|
import { euiDataGridColumnResizerStyles } from './column_resizer.styles';
|
|
22
15
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
23
16
|
var MINIMUM_COLUMN_WIDTH = 40;
|
|
24
|
-
export var EuiDataGridColumnResizer =
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
});
|
|
36
|
-
_defineProperty(_this, "onMouseDown", function (e) {
|
|
37
|
-
_this.setState({
|
|
38
|
-
initialX: e.pageX
|
|
39
|
-
});
|
|
40
|
-
window.addEventListener('mouseup', _this.onMouseUp);
|
|
41
|
-
window.addEventListener('blur', _this.onMouseUp);
|
|
42
|
-
window.addEventListener('mousemove', _this.onMouseMove);
|
|
17
|
+
export var EuiDataGridColumnResizer = function EuiDataGridColumnResizer(_ref) {
|
|
18
|
+
var columnId = _ref.columnId,
|
|
19
|
+
columnWidth = _ref.columnWidth,
|
|
20
|
+
setColumnWidth = _ref.setColumnWidth,
|
|
21
|
+
isLastColumn = _ref.isLastColumn;
|
|
22
|
+
var styles = useEuiMemoizedStyles(euiDataGridColumnResizerStyles);
|
|
23
|
+
var _useState = useState(0),
|
|
24
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
25
|
+
offset = _useState2[0],
|
|
26
|
+
setOffset = _useState2[1];
|
|
27
|
+
var initialX = useRef(0);
|
|
43
28
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
}
|
|
95
|
-
|
|
29
|
+
// Handlers are bound to `window`, so they must stay stable to be removed
|
|
30
|
+
// and read current values from a ref
|
|
31
|
+
var latest = useLatest({
|
|
32
|
+
columnId: columnId,
|
|
33
|
+
columnWidth: columnWidth,
|
|
34
|
+
setColumnWidth: setColumnWidth,
|
|
35
|
+
offset: offset
|
|
36
|
+
});
|
|
37
|
+
var onMouseMove = useCallback(function (e) {
|
|
38
|
+
var _ref2 = latest.current,
|
|
39
|
+
columnWidth = _ref2.columnWidth;
|
|
40
|
+
setOffset(Math.max(e.pageX - initialX.current, -(columnWidth - MINIMUM_COLUMN_WIDTH)));
|
|
41
|
+
}, [latest]);
|
|
42
|
+
var onMouseUp = useCallback(function () {
|
|
43
|
+
var _ref3 = latest.current,
|
|
44
|
+
columnId = _ref3.columnId,
|
|
45
|
+
columnWidth = _ref3.columnWidth,
|
|
46
|
+
setColumnWidth = _ref3.setColumnWidth,
|
|
47
|
+
offset = _ref3.offset;
|
|
48
|
+
setColumnWidth(columnId, Math.max(MINIMUM_COLUMN_WIDTH, columnWidth + offset));
|
|
49
|
+
setOffset(0);
|
|
50
|
+
window.removeEventListener('mouseup', onMouseUp);
|
|
51
|
+
window.removeEventListener('blur', onMouseUp);
|
|
52
|
+
window.removeEventListener('mousemove', onMouseMove);
|
|
53
|
+
}, [latest, onMouseMove]);
|
|
54
|
+
var onMouseDown = useCallback(function (e) {
|
|
55
|
+
initialX.current = e.pageX;
|
|
56
|
+
window.addEventListener('mouseup', onMouseUp);
|
|
57
|
+
window.addEventListener('blur', onMouseUp);
|
|
58
|
+
window.addEventListener('mousemove', onMouseMove);
|
|
59
|
+
|
|
60
|
+
// don't let this action steal focus
|
|
61
|
+
e.preventDefault();
|
|
62
|
+
}, [onMouseUp, onMouseMove]);
|
|
63
|
+
|
|
64
|
+
// Clean up listeners if unmounted mid-drag
|
|
65
|
+
useEffect(function () {
|
|
66
|
+
return function () {
|
|
67
|
+
window.removeEventListener('mouseup', onMouseUp);
|
|
68
|
+
window.removeEventListener('blur', onMouseUp);
|
|
69
|
+
window.removeEventListener('mousemove', onMouseMove);
|
|
70
|
+
};
|
|
71
|
+
}, [onMouseUp, onMouseMove]);
|
|
72
|
+
var cssStyles = [styles.euiDataGridColumnResizer, isLastColumn && styles.isLastColumn, offset && styles.isDragging];
|
|
73
|
+
return ___EmotionJSX("div", {
|
|
74
|
+
css: cssStyles,
|
|
75
|
+
className: "euiDataGridColumnResizer",
|
|
76
|
+
"data-test-subj": "dataGridColumnResizer",
|
|
77
|
+
style: offset ? logicalStyle('margin-right', "".concat(-offset, "px")) : undefined,
|
|
78
|
+
onMouseDown: onMouseDown
|
|
79
|
+
}, ___EmotionJSX(DragOverlay, {
|
|
80
|
+
isDragging: !!offset,
|
|
81
|
+
cursor: "ew-resize"
|
|
82
|
+
}));
|
|
83
|
+
};
|
|
@@ -24,7 +24,8 @@ export var EuiDataGridControlHeaderCell = /*#__PURE__*/memo(function (_ref) {
|
|
|
24
24
|
id: id,
|
|
25
25
|
index: index,
|
|
26
26
|
width: width,
|
|
27
|
-
isLastColumn: isLastColumn
|
|
27
|
+
isLastColumn: isLastColumn,
|
|
28
|
+
isControlColumn: true
|
|
28
29
|
}), ___EmotionJSX(HeaderCellRender, null));
|
|
29
30
|
});
|
|
30
31
|
EuiDataGridControlHeaderCell.displayName = 'EuiDataGridControlHeaderCell';
|
|
@@ -87,6 +87,7 @@ export var EuiDataGridHeaderCell = /*#__PURE__*/memo(function (_ref) {
|
|
|
87
87
|
id: id,
|
|
88
88
|
index: index,
|
|
89
89
|
isLastColumn: isLastColumn,
|
|
90
|
+
isLastCopyColumn: columns.length > 0 ? columns[columns.length - 1].id === id : isLastColumn,
|
|
90
91
|
width: width,
|
|
91
92
|
"aria-sort": ariaSort,
|
|
92
93
|
"aria-labelledby": cellContentId,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
4
|
-
var _excluded = ["id", "index", "isLastColumn", "width", "className", "children", "hasColumnActions", "isDragging", "onKeyDown", "aria-label", "aria-labelledby"];
|
|
4
|
+
var _excluded = ["id", "index", "isLastColumn", "isLastCopyColumn", "isControlColumn", "width", "className", "children", "hasColumnActions", "isDragging", "onKeyDown", "aria-label", "aria-labelledby"];
|
|
5
5
|
/*
|
|
6
6
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
7
7
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
@@ -27,6 +27,10 @@ export var EuiDataGridHeaderCellWrapper = function EuiDataGridHeaderCellWrapper(
|
|
|
27
27
|
var id = _ref.id,
|
|
28
28
|
index = _ref.index,
|
|
29
29
|
isLastColumn = _ref.isLastColumn,
|
|
30
|
+
_ref$isLastCopyColumn = _ref.isLastCopyColumn,
|
|
31
|
+
isLastCopyColumn = _ref$isLastCopyColumn === void 0 ? isLastColumn : _ref$isLastCopyColumn,
|
|
32
|
+
_ref$isControlColumn = _ref.isControlColumn,
|
|
33
|
+
isControlColumn = _ref$isControlColumn === void 0 ? false : _ref$isControlColumn,
|
|
30
34
|
width = _ref.width,
|
|
31
35
|
className = _ref.className,
|
|
32
36
|
children = _ref.children,
|
|
@@ -102,10 +106,10 @@ export var EuiDataGridHeaderCellWrapper = function EuiDataGridHeaderCellWrapper(
|
|
|
102
106
|
} : {},
|
|
103
107
|
"aria-label": renderFocusTrap ? ariaLabel : undefined,
|
|
104
108
|
"aria-labelledby": renderFocusTrap ? ariaLabelledby : undefined
|
|
105
|
-
}, rest), ___EmotionJSX(HandleInteractiveChildren, {
|
|
109
|
+
}, rest), isControlColumn && tabularCopyMarkers.hiddenNoCopyBoundary, ___EmotionJSX(HandleInteractiveChildren, {
|
|
106
110
|
cellEl: isDragging ? null : headerEl,
|
|
107
111
|
renderFocusTrap: isDragging ? false : renderFocusTrap,
|
|
108
112
|
updateCellFocusContext: updateCellFocusContext,
|
|
109
113
|
onInteractiveChildrenFound: setInteractiveChildren
|
|
110
|
-
}, typeof children === 'function' ? children(renderFocusTrap) : children),
|
|
114
|
+
}, typeof children === 'function' ? children(renderFocusTrap) : children), isControlColumn ? tabularCopyMarkers.hiddenNoCopyBoundary : isLastCopyColumn ? tabularCopyMarkers.hiddenNewline : tabularCopyMarkers.hiddenTab);
|
|
111
115
|
};
|
|
@@ -21,6 +21,6 @@ export var euiDataGridHeaderCellWrapperStyles = function euiDataGridHeaderCellWr
|
|
|
21
21
|
var _euiDataGridCellOutli2 = euiDataGridCellOutlineSelectors(),
|
|
22
22
|
outlineSelectors = _euiDataGridCellOutli2.header;
|
|
23
23
|
return {
|
|
24
|
-
euiDataGridHeaderCell: /*#__PURE__*/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;", logicalCSS('width', '100%'), ";};label:euiDataGridHeaderCell;")
|
|
24
|
+
euiDataGridHeaderCell: /*#__PURE__*/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;", logicalCSS('width', '100%'), ";}&:where(.euiDataGridHeaderCell--controlColumn){user-select:none;};label:euiDataGridHeaderCell;")
|
|
25
25
|
};
|
|
26
26
|
};
|
|
@@ -24,6 +24,7 @@ export var useDataGridKeyboardShortcuts = function useDataGridKeyboardShortcuts(
|
|
|
24
24
|
setIsOpen = _useState2[1];
|
|
25
25
|
var title = useEuiI18n('euiKeyboardShortcuts.title', 'Keyboard shortcuts');
|
|
26
26
|
var titleId = useGeneratedHtmlId();
|
|
27
|
+
var copyModifier = typeof navigator !== 'undefined' && /Mac|iP(hone|od|ad)/.test(navigator.platform) ? 'Cmd' : 'Ctrl';
|
|
27
28
|
var styles = useEuiMemoizedStyles(euiDataGridKeyboardShortcutsStyles);
|
|
28
29
|
var keyboardShortcuts = useMemo(function () {
|
|
29
30
|
return ___EmotionJSX(EuiPopover, {
|
|
@@ -175,9 +176,24 @@ export var useDataGridKeyboardShortcuts = function useDataGridKeyboardShortcuts(
|
|
|
175
176
|
token: "euiKeyboardShortcuts.escapeDescription",
|
|
176
177
|
default: "Close cell details and actions"
|
|
177
178
|
})
|
|
179
|
+
}, {
|
|
180
|
+
title: ___EmotionJSX(React.Fragment, null, ___EmotionJSX("kbd", null, copyModifier === 'Cmd' ? ___EmotionJSX(EuiI18n, {
|
|
181
|
+
token: "euiKeyboardShortcuts.cmd",
|
|
182
|
+
default: "Cmd"
|
|
183
|
+
}) : ___EmotionJSX(EuiI18n, {
|
|
184
|
+
token: "euiKeyboardShortcuts.ctrl",
|
|
185
|
+
default: "Ctrl"
|
|
186
|
+
})), ' ', ___EmotionJSX("kbd", null, ___EmotionJSX(EuiI18n, {
|
|
187
|
+
token: "euiKeyboardShortcuts.copyTitle",
|
|
188
|
+
default: "C"
|
|
189
|
+
}))),
|
|
190
|
+
description: ___EmotionJSX(EuiI18n, {
|
|
191
|
+
token: "euiKeyboardShortcuts.copyDescription",
|
|
192
|
+
default: "Copy the focused cell value"
|
|
193
|
+
})
|
|
178
194
|
}]
|
|
179
195
|
})));
|
|
180
|
-
}, [isOpen, title, titleId, styles]);
|
|
196
|
+
}, [isOpen, title, titleId, styles, copyModifier]);
|
|
181
197
|
return {
|
|
182
198
|
keyboardShortcuts: keyboardShortcuts
|
|
183
199
|
};
|
|
@@ -31,6 +31,7 @@ import { useInMemoryValues, EuiDataGridInMemoryRenderer } from './utils/in_memor
|
|
|
31
31
|
import { DataGridCellPopoverContext, useCellPopover } from './body/cell';
|
|
32
32
|
import { computeVisibleRows } from './utils/row_count';
|
|
33
33
|
import { schemaDetectors as providedSchemaDetectors, useMergedSchema } from './utils/data_grid_schema';
|
|
34
|
+
import { useCopyFocusedDataGridCell } from './utils/copy_focused_cell';
|
|
34
35
|
import { useImperativeGridRef } from './utils/ref';
|
|
35
36
|
import { emptyControlColumns } from './data_grid_types';
|
|
36
37
|
import { euiDataGridStyles } from './data_grid.styles';
|
|
@@ -247,6 +248,7 @@ export var EuiDataGrid = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function (pr
|
|
|
247
248
|
var showToolbar = !!toolbarVisibility;
|
|
248
249
|
var _useDataGridKeyboardS = useDataGridKeyboardShortcuts(),
|
|
249
250
|
keyboardShortcuts = _useDataGridKeyboardS.keyboardShortcuts;
|
|
251
|
+
useCopyFocusedDataGridCell();
|
|
250
252
|
var _useDataGridFullScree = useDataGridFullScreenSelector(onFullScreenChange),
|
|
251
253
|
isFullScreen = _useDataGridFullScree.isFullScreen,
|
|
252
254
|
setIsFullScreen = _useDataGridFullScree.setIsFullScreen,
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
3
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
4
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
5
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
6
|
+
* Side Public License, v 1.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { useEffect } from 'react';
|
|
10
|
+
|
|
11
|
+
/** Copies the focused data cell value when nothing is selected. */
|
|
12
|
+
export var copyFocusedDataGridCell = function copyFocusedDataGridCell(event) {
|
|
13
|
+
var _window$getSelection, _ref, _cellContent$innerTex;
|
|
14
|
+
if (event.defaultPrevented) return;
|
|
15
|
+
var cell = document.activeElement;
|
|
16
|
+
if (!(cell instanceof HTMLElement)) return;
|
|
17
|
+
if (!cell.classList.contains('euiDataGridRowCell')) return;
|
|
18
|
+
if (cell.classList.contains('euiDataGridRowCell--controlColumn')) return;
|
|
19
|
+
if ((_window$getSelection = window.getSelection()) !== null && _window$getSelection !== void 0 && _window$getSelection.toString()) return;
|
|
20
|
+
if (!event.clipboardData) return;
|
|
21
|
+
var cellContent = cell.querySelector('[data-datagrid-cellcontent]');
|
|
22
|
+
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 : '';
|
|
23
|
+
if (!text) return;
|
|
24
|
+
event.clipboardData.setData('text/plain', text);
|
|
25
|
+
event.preventDefault();
|
|
26
|
+
};
|
|
27
|
+
export var useCopyFocusedDataGridCell = function useCopyFocusedDataGridCell() {
|
|
28
|
+
useEffect(function () {
|
|
29
|
+
// The handler is static, so the browser dedupes identical listeners.
|
|
30
|
+
// Do not remove on unmount — that would disable copy for remaining grids.
|
|
31
|
+
// Same approach as OverrideCopiedTabularContent.
|
|
32
|
+
document.addEventListener('copy', copyFocusedDataGridCell);
|
|
33
|
+
}, []);
|
|
34
|
+
};
|
|
@@ -235,7 +235,7 @@ describe('EuiFilterGroup multiselect example', function () {
|
|
|
235
235
|
cy.realPress('Enter');
|
|
236
236
|
cy.get('input[role="combobox"]').then(function ($input) {
|
|
237
237
|
var activeOptionId = $input.attr('aria-activedescendant');
|
|
238
|
-
cy.get("li[id=\"".concat(activeOptionId, "\"]")).find('span.euiSelectableListItem__text').should('have.text', 'Dmitri Shostakovich.
|
|
238
|
+
cy.get("li[id=\"".concat(activeOptionId, "\"]")).find('span.euiSelectableListItem__text').should('have.text', 'Dmitri Shostakovich. To exclude this option, press Enter.');
|
|
239
239
|
});
|
|
240
240
|
cy.realPress('ArrowDown');
|
|
241
241
|
cy.repeatRealPress('Enter');
|