@elastic/eui 95.11.0 → 95.12.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/README.md +1 -69
- package/es/components/basic_table/basic_table.js +39 -32
- package/es/components/datagrid/body/cell/data_grid_cell.js +121 -15
- package/es/components/datagrid/body/cell/data_grid_cell.styles.js +5 -2
- package/es/components/datagrid/body/data_grid_body_custom.js +5 -2
- package/es/components/datagrid/body/data_grid_body_virtualized.js +5 -2
- package/es/components/datagrid/body/footer/data_grid_footer_row.js +17 -9
- package/es/components/datagrid/body/header/data_grid_control_header_cell.js +5 -2
- package/es/components/datagrid/body/header/data_grid_header_cell.js +3 -1
- package/es/components/datagrid/body/header/data_grid_header_cell.styles.js +0 -2
- package/es/components/datagrid/body/header/data_grid_header_cell_wrapper.js +6 -3
- package/es/components/datagrid/body/header/data_grid_header_row.js +5 -1
- package/es/components/datagrid/data_grid.js +3 -3
- package/es/components/datagrid/data_grid.stories.utils.js +65 -29
- package/es/components/datagrid/utils/row_heights.js +9 -33
- package/es/components/date_picker/date_picker.js +1 -1
- package/es/components/provider/provider.js +16 -13
- package/es/components/provider/system_color_mode/index.js +9 -0
- package/es/components/provider/system_color_mode/system_color_mode_provider.js +49 -0
- package/es/components/resizable_container/resizable_button.js +9 -2
- package/es/components/resizable_container/resizable_button.styles.js +19 -6
- package/es/components/table/table_header_cell.js +10 -3
- package/es/components/table/table_header_cell_checkbox.js +5 -3
- package/es/components/table/table_row_cell.js +10 -3
- package/es/components/table/table_row_cell_checkbox.js +5 -3
- package/es/services/copy/index.js +10 -0
- package/es/services/copy/tabular_copy.js +103 -0
- package/es/services/index.js +1 -1
- package/eui.d.ts +162 -67
- package/i18ntokens.json +90 -90
- package/lib/components/basic_table/basic_table.js +38 -31
- package/lib/components/datagrid/body/cell/data_grid_cell.js +120 -14
- package/lib/components/datagrid/body/cell/data_grid_cell.styles.js +5 -2
- package/lib/components/datagrid/body/data_grid_body_custom.js +5 -2
- package/lib/components/datagrid/body/data_grid_body_virtualized.js +5 -2
- package/lib/components/datagrid/body/footer/data_grid_footer_row.js +13 -5
- package/lib/components/datagrid/body/header/data_grid_control_header_cell.js +5 -2
- package/lib/components/datagrid/body/header/data_grid_header_cell.js +3 -1
- package/lib/components/datagrid/body/header/data_grid_header_cell.styles.js +0 -2
- package/lib/components/datagrid/body/header/data_grid_header_cell_wrapper.js +5 -2
- package/lib/components/datagrid/body/header/data_grid_header_row.js +5 -1
- package/lib/components/datagrid/data_grid.js +2 -2
- package/lib/components/datagrid/data_grid.stories.utils.js +66 -31
- package/lib/components/datagrid/utils/row_heights.js +8 -32
- package/lib/components/date_picker/date_picker.js +1 -1
- package/lib/components/provider/provider.js +16 -13
- package/lib/components/provider/system_color_mode/index.js +12 -0
- package/lib/components/provider/system_color_mode/system_color_mode_provider.js +54 -0
- package/lib/components/resizable_container/resizable_button.js +9 -2
- package/lib/components/resizable_container/resizable_button.styles.js +19 -6
- package/lib/components/table/table_header_cell.js +10 -3
- package/lib/components/table/table_header_cell_checkbox.js +5 -3
- package/lib/components/table/table_row_cell.js +10 -3
- package/lib/components/table/table_row_cell_checkbox.js +5 -3
- package/lib/services/copy/index.js +25 -0
- package/lib/services/copy/tabular_copy.js +111 -0
- package/lib/services/index.js +12 -8
- package/optimize/es/components/basic_table/basic_table.js +39 -32
- package/optimize/es/components/datagrid/body/cell/data_grid_cell.js +18 -14
- package/optimize/es/components/datagrid/body/cell/data_grid_cell.styles.js +5 -2
- package/optimize/es/components/datagrid/body/data_grid_body_custom.js +5 -2
- package/optimize/es/components/datagrid/body/data_grid_body_virtualized.js +5 -2
- package/optimize/es/components/datagrid/body/footer/data_grid_footer_row.js +17 -9
- package/optimize/es/components/datagrid/body/header/data_grid_control_header_cell.js +4 -2
- package/optimize/es/components/datagrid/body/header/data_grid_header_cell.js +3 -1
- package/optimize/es/components/datagrid/body/header/data_grid_header_cell.styles.js +0 -2
- package/optimize/es/components/datagrid/body/header/data_grid_header_cell_wrapper.js +5 -3
- package/optimize/es/components/datagrid/body/header/data_grid_header_row.js +5 -1
- package/optimize/es/components/datagrid/data_grid.js +3 -3
- package/optimize/es/components/datagrid/data_grid.stories.utils.js +65 -29
- package/optimize/es/components/datagrid/utils/row_heights.js +9 -33
- package/optimize/es/components/date_picker/date_picker.js +1 -1
- package/optimize/es/components/provider/provider.js +16 -13
- package/optimize/es/components/provider/system_color_mode/index.js +9 -0
- package/optimize/es/components/provider/system_color_mode/system_color_mode_provider.js +40 -0
- package/optimize/es/components/resizable_container/resizable_button.js +3 -2
- package/optimize/es/components/resizable_container/resizable_button.styles.js +19 -6
- package/optimize/es/components/table/table_header_cell.js +3 -2
- package/optimize/es/components/table/table_header_cell_checkbox.js +3 -2
- package/optimize/es/components/table/table_row_cell.js +4 -3
- package/optimize/es/components/table/table_row_cell_checkbox.js +3 -2
- package/optimize/es/services/copy/index.js +10 -0
- package/optimize/es/services/copy/tabular_copy.js +103 -0
- package/optimize/es/services/index.js +1 -1
- package/optimize/lib/components/basic_table/basic_table.js +38 -31
- package/optimize/lib/components/datagrid/body/cell/data_grid_cell.js +17 -13
- package/optimize/lib/components/datagrid/body/cell/data_grid_cell.styles.js +5 -2
- package/optimize/lib/components/datagrid/body/data_grid_body_custom.js +5 -2
- package/optimize/lib/components/datagrid/body/data_grid_body_virtualized.js +5 -2
- package/optimize/lib/components/datagrid/body/footer/data_grid_footer_row.js +13 -5
- package/optimize/lib/components/datagrid/body/header/data_grid_control_header_cell.js +4 -2
- package/optimize/lib/components/datagrid/body/header/data_grid_header_cell.js +3 -1
- package/optimize/lib/components/datagrid/body/header/data_grid_header_cell.styles.js +0 -2
- package/optimize/lib/components/datagrid/body/header/data_grid_header_cell_wrapper.js +4 -2
- package/optimize/lib/components/datagrid/body/header/data_grid_header_row.js +5 -1
- package/optimize/lib/components/datagrid/data_grid.js +2 -2
- package/optimize/lib/components/datagrid/data_grid.stories.utils.js +70 -37
- package/optimize/lib/components/datagrid/utils/row_heights.js +8 -32
- package/optimize/lib/components/date_picker/date_picker.js +1 -1
- package/optimize/lib/components/provider/provider.js +16 -13
- package/optimize/lib/components/provider/system_color_mode/index.js +12 -0
- package/optimize/lib/components/provider/system_color_mode/system_color_mode_provider.js +47 -0
- package/optimize/lib/components/resizable_container/resizable_button.js +3 -2
- package/optimize/lib/components/resizable_container/resizable_button.styles.js +19 -6
- package/optimize/lib/components/table/table_header_cell.js +3 -2
- package/optimize/lib/components/table/table_header_cell_checkbox.js +3 -2
- package/optimize/lib/components/table/table_row_cell.js +4 -3
- package/optimize/lib/components/table/table_row_cell_checkbox.js +3 -2
- package/optimize/lib/services/copy/index.js +25 -0
- package/optimize/lib/services/copy/tabular_copy.js +111 -0
- package/optimize/lib/services/index.js +12 -8
- package/package.json +1 -1
- package/test-env/components/basic_table/basic_table.js +38 -31
- package/test-env/components/datagrid/body/cell/data_grid_cell.js +120 -14
- package/test-env/components/datagrid/body/cell/data_grid_cell.styles.js +5 -2
- package/test-env/components/datagrid/body/data_grid_body_custom.js +5 -2
- package/test-env/components/datagrid/body/data_grid_body_virtualized.js +5 -2
- package/test-env/components/datagrid/body/footer/data_grid_footer_row.js +13 -5
- package/test-env/components/datagrid/body/header/data_grid_control_header_cell.js +5 -2
- package/test-env/components/datagrid/body/header/data_grid_header_cell.js +3 -1
- package/test-env/components/datagrid/body/header/data_grid_header_cell.styles.js +0 -2
- package/test-env/components/datagrid/body/header/data_grid_header_cell_wrapper.js +5 -2
- package/test-env/components/datagrid/body/header/data_grid_header_row.js +5 -1
- package/test-env/components/datagrid/data_grid.js +2 -2
- package/test-env/components/datagrid/data_grid.stories.utils.js +70 -37
- package/test-env/components/datagrid/utils/row_heights.js +8 -32
- package/test-env/components/date_picker/date_picker.js +1 -1
- package/test-env/components/provider/provider.js +16 -13
- package/test-env/components/provider/system_color_mode/index.js +12 -0
- package/test-env/components/provider/system_color_mode/system_color_mode_provider.js +51 -0
- package/test-env/components/resizable_container/resizable_button.js +9 -2
- package/test-env/components/resizable_container/resizable_button.styles.js +19 -6
- package/test-env/components/table/table_header_cell.js +10 -3
- package/test-env/components/table/table_header_cell_checkbox.js +5 -3
- package/test-env/components/table/table_row_cell.js +10 -3
- package/test-env/components/table/table_row_cell_checkbox.js +5 -3
- package/test-env/services/copy/index.js +25 -0
- package/test-env/services/copy/tabular_copy.js +30 -0
- package/test-env/services/index.js +12 -8
- /package/es/services/{copy_to_clipboard.js → copy/copy_to_clipboard.js} +0 -0
- /package/lib/services/{copy_to_clipboard.js → copy/copy_to_clipboard.js} +0 -0
- /package/optimize/es/services/{copy_to_clipboard.js → copy/copy_to_clipboard.js} +0 -0
- /package/optimize/lib/services/{copy_to_clipboard.js → copy/copy_to_clipboard.js} +0 -0
- /package/test-env/services/{copy_to_clipboard.js → copy/copy_to_clipboard.js} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
-
var _excluded = ["children", "className", "scope", "style", "width"];
|
|
3
|
+
var _excluded = ["children", "className", "scope", "style", "width", "append"];
|
|
4
4
|
/*
|
|
5
5
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
6
6
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
@@ -22,6 +22,7 @@ export var EuiTableHeaderCellCheckbox = function EuiTableHeaderCellCheckbox(_ref
|
|
|
22
22
|
scope = _ref$scope === void 0 ? 'col' : _ref$scope,
|
|
23
23
|
style = _ref.style,
|
|
24
24
|
width = _ref.width,
|
|
25
|
+
append = _ref.append,
|
|
25
26
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
26
27
|
var classes = classNames('euiTableHeaderCellCheckbox', className);
|
|
27
28
|
var styles = useEuiMemoizedStyles(euiTableCellCheckboxStyles);
|
|
@@ -33,5 +34,5 @@ export var EuiTableHeaderCellCheckbox = function EuiTableHeaderCellCheckbox(_ref
|
|
|
33
34
|
style: inlineStyles
|
|
34
35
|
}, rest), ___EmotionJSX("div", {
|
|
35
36
|
className: "euiTableCellContent"
|
|
36
|
-
}, children));
|
|
37
|
+
}, children), append);
|
|
37
38
|
};
|
|
@@ -2,7 +2,7 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
2
2
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
3
|
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
4
4
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
5
|
-
var _excluded = ["align", "children", "className", "truncateText", "setScopeRow", "textOnly", "hasActions", "isExpander", "style", "width", "valign", "mobileOptions"];
|
|
5
|
+
var _excluded = ["align", "children", "className", "truncateText", "setScopeRow", "textOnly", "hasActions", "isExpander", "style", "width", "valign", "mobileOptions", "append"];
|
|
6
6
|
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; }
|
|
7
7
|
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; }
|
|
8
8
|
/*
|
|
@@ -37,6 +37,7 @@ export var EuiTableRowCell = function EuiTableRowCell(_ref) {
|
|
|
37
37
|
_ref$valign = _ref.valign,
|
|
38
38
|
valign = _ref$valign === void 0 ? 'middle' : _ref$valign,
|
|
39
39
|
mobileOptions = _ref.mobileOptions,
|
|
40
|
+
append = _ref.append,
|
|
40
41
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
41
42
|
var isResponsive = useEuiTableIsResponsive();
|
|
42
43
|
var styles = useEuiMemoizedStyles(euiTableRowCellStyles);
|
|
@@ -76,7 +77,7 @@ export var EuiTableRowCell = function EuiTableRowCell(_ref) {
|
|
|
76
77
|
,
|
|
77
78
|
truncateText: (_mobileOptions$trunca = mobileOptions === null || mobileOptions === void 0 ? void 0 : mobileOptions.truncateText) !== null && _mobileOptions$trunca !== void 0 ? _mobileOptions$trunca : truncateText,
|
|
78
79
|
textOnly: (_mobileOptions$textOn = mobileOptions === null || mobileOptions === void 0 ? void 0 : mobileOptions.textOnly) !== null && _mobileOptions$textOn !== void 0 ? _mobileOptions$textOn : textOnly
|
|
79
|
-
}), (mobileOptions === null || mobileOptions === void 0 ? void 0 : mobileOptions.render) || children));
|
|
80
|
+
}), (mobileOptions === null || mobileOptions === void 0 ? void 0 : mobileOptions.render) || children), append);
|
|
80
81
|
}
|
|
81
82
|
} else {
|
|
82
83
|
// Desktop view
|
|
@@ -85,7 +86,7 @@ export var EuiTableRowCell = function EuiTableRowCell(_ref) {
|
|
|
85
86
|
} else {
|
|
86
87
|
return ___EmotionJSX(Element, _extends({
|
|
87
88
|
className: cellClasses
|
|
88
|
-
}, sharedProps), ___EmotionJSX(EuiTableCellContent, sharedContentProps, children));
|
|
89
|
+
}, sharedProps), ___EmotionJSX(EuiTableCellContent, sharedContentProps, children), append);
|
|
89
90
|
}
|
|
90
91
|
}
|
|
91
92
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
-
var _excluded = ["children", "className"];
|
|
3
|
+
var _excluded = ["children", "className", "append"];
|
|
4
4
|
/*
|
|
5
5
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
6
6
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
@@ -18,6 +18,7 @@ import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
|
18
18
|
export var EuiTableRowCellCheckbox = function EuiTableRowCellCheckbox(_ref) {
|
|
19
19
|
var children = _ref.children,
|
|
20
20
|
className = _ref.className,
|
|
21
|
+
append = _ref.append,
|
|
21
22
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
22
23
|
var isResponsive = useEuiTableIsResponsive();
|
|
23
24
|
var styles = useEuiMemoizedStyles(euiTableCellCheckboxStyles);
|
|
@@ -28,5 +29,5 @@ export var EuiTableRowCellCheckbox = function EuiTableRowCellCheckbox(_ref) {
|
|
|
28
29
|
className: classes
|
|
29
30
|
}, rest), ___EmotionJSX("div", {
|
|
30
31
|
className: "euiTableCellContent"
|
|
31
|
-
}, children));
|
|
32
|
+
}, children), append);
|
|
32
33
|
};
|
|
@@ -0,0 +1,10 @@
|
|
|
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
|
+
export { copyToClipboard } from './copy_to_clipboard';
|
|
10
|
+
export { tabularCopyMarkers, OverrideCopiedTabularContent } from './tabular_copy';
|
|
@@ -0,0 +1,103 @@
|
|
|
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 React, { useEffect } from 'react';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Clipboard text cleaning logic
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
// Special visually hidden unicode characters that we use to manually clean content
|
|
16
|
+
// and force our own newlines/horizontal tabs
|
|
17
|
+
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
18
|
+
export var CHARS = {
|
|
19
|
+
NEWLINE: '↵',
|
|
20
|
+
TAB: '↦',
|
|
21
|
+
// Use multiple characters to reduce the chances of consumers also using these characters
|
|
22
|
+
TABULAR_CONTENT_BOUND: '𐘂𐘂',
|
|
23
|
+
NO_COPY_BOUND: '✄𐘗'
|
|
24
|
+
};
|
|
25
|
+
// This regex finds all content between two bounds
|
|
26
|
+
var noCopyBoundsRegex = new RegExp("".concat(CHARS.NO_COPY_BOUND, "[^").concat(CHARS.NO_COPY_BOUND, "]*").concat(CHARS.NO_COPY_BOUND), 'gs');
|
|
27
|
+
var hasCharsToReplace = function hasCharsToReplace(text) {
|
|
28
|
+
for (var _i = 0, _Object$values = Object.values(CHARS); _i < _Object$values.length; _i++) {
|
|
29
|
+
var char = _Object$values[_i];
|
|
30
|
+
if (text.indexOf(char) >= 0) return true;
|
|
31
|
+
}
|
|
32
|
+
return false;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
// Strip all existing newlines and replace our special hidden characters
|
|
36
|
+
// with the desired spacing needed to paste cleanly into a spreadsheet
|
|
37
|
+
export var onTabularCopy = function onTabularCopy(event) {
|
|
38
|
+
var _window$getSelection;
|
|
39
|
+
if (!event.clipboardData) return;
|
|
40
|
+
var selectedText = (_window$getSelection = window.getSelection()) === null || _window$getSelection === void 0 ? void 0 : _window$getSelection.toString();
|
|
41
|
+
if (!selectedText || !hasCharsToReplace(selectedText)) return;
|
|
42
|
+
var amendedText = selectedText.split(CHARS.TABULAR_CONTENT_BOUND).map(function (text) {
|
|
43
|
+
return hasCharsToReplace(text) ? text.replace(/\r?\n/g, '') // remove all other newlines generated by content or block display
|
|
44
|
+
.replaceAll(CHARS.NEWLINE, '\n') // insert newline for each table/grid row
|
|
45
|
+
.replace(/\t/g, '') // remove tabs generated by content or automatically by <td> elements
|
|
46
|
+
.replaceAll(CHARS.TAB, "\t") // insert horizontal tab for each table/grid cell
|
|
47
|
+
.replace(noCopyBoundsRegex, '') // remove text that should not be copied (e.g. screen reader instructions)
|
|
48
|
+
: text;
|
|
49
|
+
}).join('');
|
|
50
|
+
event.clipboardData.setData('text/plain', amendedText);
|
|
51
|
+
event.preventDefault();
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* JSX utils for rendering the hidden marker characters
|
|
56
|
+
*/
|
|
57
|
+
|
|
58
|
+
var VisuallyHide = function VisuallyHide(_ref) {
|
|
59
|
+
var children = _ref.children,
|
|
60
|
+
_ref$type = _ref.type,
|
|
61
|
+
type = _ref$type === void 0 ? 'true' : _ref$type;
|
|
62
|
+
return (
|
|
63
|
+
// Hides the characters to both sighted user and screen readers
|
|
64
|
+
// Sadly, we can't use `hidden` as that hides the chars from the clipboard as well
|
|
65
|
+
___EmotionJSX("span", {
|
|
66
|
+
className: "euiScreenReaderOnly",
|
|
67
|
+
"aria-hidden": true,
|
|
68
|
+
"data-tabular-copy-marker": type
|
|
69
|
+
}, children)
|
|
70
|
+
);
|
|
71
|
+
};
|
|
72
|
+
export var tabularCopyMarkers = {
|
|
73
|
+
hiddenTab: ___EmotionJSX(VisuallyHide, {
|
|
74
|
+
type: "tab"
|
|
75
|
+
}, CHARS.TAB),
|
|
76
|
+
hiddenNewline: ___EmotionJSX(VisuallyHide, {
|
|
77
|
+
type: "newline"
|
|
78
|
+
}, CHARS.NEWLINE),
|
|
79
|
+
hiddenWrapperBoundary: ___EmotionJSX(VisuallyHide, {
|
|
80
|
+
type: "boundary"
|
|
81
|
+
}, CHARS.TABULAR_CONTENT_BOUND),
|
|
82
|
+
hiddenNoCopyBoundary: ___EmotionJSX(VisuallyHide, {
|
|
83
|
+
type: "no-copy"
|
|
84
|
+
}, CHARS.NO_COPY_BOUND)
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Wrapper setup around table/grid tabular content we want to override/clean up on copy
|
|
89
|
+
*/
|
|
90
|
+
|
|
91
|
+
export var OverrideCopiedTabularContent = function OverrideCopiedTabularContent(_ref2) {
|
|
92
|
+
var children = _ref2.children;
|
|
93
|
+
useEffect(function () {
|
|
94
|
+
// Chrome and webkit browsers work perfectly when passing `onTabularCopy` to a React
|
|
95
|
+
// `onCopy` prop, but sadly Firefox does not if copying more than just the table/grid
|
|
96
|
+
// (e.g. Ctrl+A). So we have to set up a global window event listener
|
|
97
|
+
window.document.addEventListener('copy', onTabularCopy);
|
|
98
|
+
// Note: Since onCopy is static, we don't have to worry about duplicate
|
|
99
|
+
// event listeners - it's automatically handled by the browser. See:
|
|
100
|
+
// https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener#Multiple_identical_event_listeners
|
|
101
|
+
}, []);
|
|
102
|
+
return ___EmotionJSX(React.Fragment, null, tabularCopyMarkers.hiddenWrapperBoundary, children, tabularCopyMarkers.hiddenWrapperBoundary);
|
|
103
|
+
};
|
|
@@ -15,7 +15,7 @@ export { CanvasTextUtils } from './canvas';
|
|
|
15
15
|
export { brighten, calculateContrast, calculateLuminance, colorPalette, darken, DEFAULT_VISUALIZATION_COLOR, desaturate, euiPaletteColorBlind, euiPaletteColorBlindBehindText, euiPaletteComplementary, euiPaletteCool, euiPaletteForDarkBackground, euiPaletteForLightBackground, euiPaletteForStatus, euiPaletteForTemperature, euiPaletteGray, euiPaletteRed, euiPaletteGreen, euiPaletteWarm, getSteppedGradient, hexToHsv, hexToRgb, hsvToHex, hsvToRgb, isColorDark, isValidHex, lightness, makeDisabledContrastColor, makeHighContrastColor, rgbToHex, rgbToHsv, saturate, shade, shadeOrTint, tint, tintOrShade, transparentize, VISUALIZATION_COLORS, wcagContrastMin } from './color';
|
|
16
16
|
export { useColorPickerState, useColorStopsState } from './color_picker';
|
|
17
17
|
export * from './console';
|
|
18
|
-
export
|
|
18
|
+
export * from './copy';
|
|
19
19
|
export * from './emotion';
|
|
20
20
|
export * from './findElement';
|
|
21
21
|
export { dateFormatAliases, formatAuto, formatBoolean, formatDate, formatNumber, formatText } from './format';
|
|
@@ -177,6 +177,10 @@ var EuiBasicTable = exports.EuiBasicTable = /*#__PURE__*/function (_Component) {
|
|
|
177
177
|
});
|
|
178
178
|
});
|
|
179
179
|
});
|
|
180
|
+
(0, _defineProperty2.default)(_this, "renderCopyChar", function (columnIndex) {
|
|
181
|
+
var isLastColumn = columnIndex === _this.props.columns.length - 1;
|
|
182
|
+
return isLastColumn ? _services.tabularCopyMarkers.hiddenNewline : _services.tabularCopyMarkers.hiddenTab;
|
|
183
|
+
});
|
|
180
184
|
(0, _defineProperty2.default)(_this, "resolveColumnSortDirection", function (column) {
|
|
181
185
|
var sorting = _this.props.sorting;
|
|
182
186
|
var _ref5 = column,
|
|
@@ -377,13 +381,13 @@ var EuiBasicTable = exports.EuiBasicTable = /*#__PURE__*/function (_Component) {
|
|
|
377
381
|
loading = _this$props3.loading;
|
|
378
382
|
return (0, _react2.jsx)(_react.default.Fragment, null, (0, _react2.jsx)(_table.EuiTableHeaderMobile, {
|
|
379
383
|
responsiveBreakpoint: responsiveBreakpoint
|
|
380
|
-
}, this.renderSelectAll(true), this.renderTableMobileSort()), (0, _react2.jsx)(_table.EuiTable, {
|
|
384
|
+
}, this.renderSelectAll(true), this.renderTableMobileSort()), (0, _react2.jsx)(_services.OverrideCopiedTabularContent, null, (0, _react2.jsx)(_table.EuiTable, {
|
|
381
385
|
id: this.tableId,
|
|
382
386
|
tableLayout: tableLayout,
|
|
383
387
|
responsiveBreakpoint: responsiveBreakpoint,
|
|
384
388
|
compressed: compressed,
|
|
385
389
|
css: loading && _basic_table.safariLoadingWorkaround
|
|
386
|
-
}, this.renderTableCaption(), this.renderTableHead(), this.renderTableBody(), this.renderTableFooter()));
|
|
390
|
+
}, this.renderTableCaption(), this.renderTableHead(), this.renderTableBody(), this.renderTableFooter())));
|
|
387
391
|
}
|
|
388
392
|
}, {
|
|
389
393
|
key: "renderTableMobileSort",
|
|
@@ -482,7 +486,7 @@ var EuiBasicTable = exports.EuiBasicTable = /*#__PURE__*/function (_Component) {
|
|
|
482
486
|
return (0, _react2.jsx)(_accessibility.EuiScreenReaderOnly, null, (0, _react2.jsx)("caption", {
|
|
483
487
|
css: _table2.euiTableCaptionStyles,
|
|
484
488
|
className: "euiTableCaption"
|
|
485
|
-
}, (0, _react2.jsx)(_delay_render.EuiDelayRender, null, captionElement)));
|
|
489
|
+
}, _services.tabularCopyMarkers.hiddenNoCopyBoundary, (0, _react2.jsx)(_delay_render.EuiDelayRender, null, captionElement), _services.tabularCopyMarkers.hiddenNoCopyBoundary));
|
|
486
490
|
}
|
|
487
491
|
}, {
|
|
488
492
|
key: "renderTableHead",
|
|
@@ -494,7 +498,8 @@ var EuiBasicTable = exports.EuiBasicTable = /*#__PURE__*/function (_Component) {
|
|
|
494
498
|
var headers = [];
|
|
495
499
|
if (selection) {
|
|
496
500
|
headers.push((0, _react2.jsx)(_table.EuiTableHeaderCellCheckbox, {
|
|
497
|
-
key: "_selection_column_h"
|
|
501
|
+
key: "_selection_column_h",
|
|
502
|
+
append: this.renderCopyChar(-1)
|
|
498
503
|
}, this.renderSelectAll(false)));
|
|
499
504
|
}
|
|
500
505
|
columns.forEach(function (column, index) {
|
|
@@ -509,16 +514,20 @@ var EuiBasicTable = exports.EuiBasicTable = /*#__PURE__*/function (_Component) {
|
|
|
509
514
|
readOnly = _ref8.readOnly,
|
|
510
515
|
description = _ref8.description;
|
|
511
516
|
var columnAlign = align || _this3.getAlignForDataType(dataType);
|
|
517
|
+
var sharedProps = {
|
|
518
|
+
width: width,
|
|
519
|
+
description: description,
|
|
520
|
+
mobileOptions: mobileOptions,
|
|
521
|
+
align: columnAlign,
|
|
522
|
+
append: _this3.renderCopyChar(index)
|
|
523
|
+
};
|
|
512
524
|
|
|
513
525
|
// actions column
|
|
514
526
|
if (column.actions) {
|
|
515
|
-
headers.push((0, _react2.jsx)(_table.EuiTableHeaderCell, {
|
|
527
|
+
headers.push((0, _react2.jsx)(_table.EuiTableHeaderCell, (0, _extends2.default)({}, sharedProps, {
|
|
516
528
|
key: "_actions_h_".concat(index),
|
|
517
|
-
align: "right"
|
|
518
|
-
|
|
519
|
-
description: description,
|
|
520
|
-
mobileOptions: mobileOptions
|
|
521
|
-
}, name));
|
|
529
|
+
align: "right"
|
|
530
|
+
}), name));
|
|
522
531
|
return;
|
|
523
532
|
}
|
|
524
533
|
|
|
@@ -533,13 +542,9 @@ var EuiBasicTable = exports.EuiBasicTable = /*#__PURE__*/function (_Component) {
|
|
|
533
542
|
_sorting.onSort = _this3.resolveColumnOnSort(column);
|
|
534
543
|
_sorting.readOnly = _this3.props.sorting.readOnly || readOnly;
|
|
535
544
|
}
|
|
536
|
-
headers.push((0, _react2.jsx)(_table.EuiTableHeaderCell, (0, _extends2.default)({
|
|
545
|
+
headers.push((0, _react2.jsx)(_table.EuiTableHeaderCell, (0, _extends2.default)({}, sharedProps, {
|
|
537
546
|
key: "_computed_column_h_".concat(index),
|
|
538
|
-
|
|
539
|
-
width: width,
|
|
540
|
-
mobileOptions: mobileOptions,
|
|
541
|
-
"data-test-subj": "tableHeaderCell_".concat(typeof name === 'string' ? name : '', "_").concat(index),
|
|
542
|
-
description: description
|
|
547
|
+
"data-test-subj": "tableHeaderCell_".concat(typeof name === 'string' ? name : '', "_").concat(index)
|
|
543
548
|
}, _sorting), name));
|
|
544
549
|
return;
|
|
545
550
|
}
|
|
@@ -562,13 +567,9 @@ var EuiBasicTable = exports.EuiBasicTable = /*#__PURE__*/function (_Component) {
|
|
|
562
567
|
sorting.readOnly = _this3.props.sorting.readOnly || readOnly;
|
|
563
568
|
}
|
|
564
569
|
}
|
|
565
|
-
headers.push((0, _react2.jsx)(_table.EuiTableHeaderCell, (0, _extends2.default)({
|
|
570
|
+
headers.push((0, _react2.jsx)(_table.EuiTableHeaderCell, (0, _extends2.default)({}, sharedProps, {
|
|
566
571
|
key: "_data_h_".concat(String(field), "_").concat(index),
|
|
567
|
-
|
|
568
|
-
width: width,
|
|
569
|
-
mobileOptions: mobileOptions,
|
|
570
|
-
"data-test-subj": "tableHeaderCell_".concat(String(field), "_").concat(index),
|
|
571
|
-
description: description
|
|
572
|
+
"data-test-subj": "tableHeaderCell_".concat(String(field), "_").concat(index)
|
|
572
573
|
}, sorting), name));
|
|
573
574
|
});
|
|
574
575
|
return (0, _react2.jsx)(_table.EuiTableHeader, null, headers);
|
|
@@ -734,7 +735,8 @@ var EuiBasicTable = exports.EuiBasicTable = /*#__PURE__*/function (_Component) {
|
|
|
734
735
|
hasSelection: !!selection
|
|
735
736
|
}, (0, _react2.jsx)(_table.EuiTableRowCell, {
|
|
736
737
|
colSpan: expandedRowColSpan,
|
|
737
|
-
textOnly: false
|
|
738
|
+
textOnly: false,
|
|
739
|
+
append: _services.tabularCopyMarkers.hiddenNewline
|
|
738
740
|
}, itemIdToExpandedRowMap[itemId])) : undefined;
|
|
739
741
|
var rowPropsCallback = this.props.rowProps;
|
|
740
742
|
var rowProps = getRowProps(item, rowPropsCallback);
|
|
@@ -773,7 +775,8 @@ var EuiBasicTable = exports.EuiBasicTable = /*#__PURE__*/function (_Component) {
|
|
|
773
775
|
}
|
|
774
776
|
};
|
|
775
777
|
return [(0, _react2.jsx)(_table.EuiTableRowCellCheckbox, {
|
|
776
|
-
key: key
|
|
778
|
+
key: key,
|
|
779
|
+
append: this.renderCopyChar(-1)
|
|
777
780
|
}, (0, _react2.jsx)(_i18n.EuiI18n, {
|
|
778
781
|
token: "euiBasicTable.selectThisRow",
|
|
779
782
|
default: "Select row {index}",
|
|
@@ -842,7 +845,8 @@ var EuiBasicTable = exports.EuiBasicTable = /*#__PURE__*/function (_Component) {
|
|
|
842
845
|
key: key,
|
|
843
846
|
align: "right",
|
|
844
847
|
textOnly: false,
|
|
845
|
-
hasActions: hasCustomActions ? 'custom' : true
|
|
848
|
+
hasActions: hasCustomActions ? 'custom' : true,
|
|
849
|
+
append: this.renderCopyChar(columnIndex)
|
|
846
850
|
}, (0, _react2.jsx)(_expanded_item_actions.ExpandedItemActions, {
|
|
847
851
|
actions: actualActions,
|
|
848
852
|
actionsDisabled: allDisabled,
|
|
@@ -860,7 +864,7 @@ var EuiBasicTable = exports.EuiBasicTable = /*#__PURE__*/function (_Component) {
|
|
|
860
864
|
var contentRenderer = render || this.getRendererForDataType(dataType);
|
|
861
865
|
var value = (0, _objects.get)(item, field);
|
|
862
866
|
var content = contentRenderer(value, item);
|
|
863
|
-
return this.renderItemCell(item, column, key, content, setScopeRow);
|
|
867
|
+
return this.renderItemCell(item, column, columnIndex, key, content, setScopeRow);
|
|
864
868
|
}
|
|
865
869
|
}, {
|
|
866
870
|
key: "renderItemComputedCell",
|
|
@@ -869,11 +873,12 @@ var EuiBasicTable = exports.EuiBasicTable = /*#__PURE__*/function (_Component) {
|
|
|
869
873
|
var key = "_computed_column_".concat(itemId, "_").concat(columnIndex);
|
|
870
874
|
var contentRenderer = render || this.getRendererForDataType();
|
|
871
875
|
var content = contentRenderer(item);
|
|
872
|
-
return this.renderItemCell(item, column, key, content, false);
|
|
876
|
+
return this.renderItemCell(item, column, columnIndex, key, content, false);
|
|
873
877
|
}
|
|
874
878
|
}, {
|
|
875
879
|
key: "renderItemCell",
|
|
876
|
-
value: function renderItemCell(item, column, key, content, setScopeRow) {
|
|
880
|
+
value: function renderItemCell(item, column, columnIndex, key, content, setScopeRow) {
|
|
881
|
+
var _mobileOptions$render, _mobileOptions$header;
|
|
877
882
|
var _ref11 = column,
|
|
878
883
|
align = _ref11.align,
|
|
879
884
|
render = _ref11.render,
|
|
@@ -897,10 +902,12 @@ var EuiBasicTable = exports.EuiBasicTable = /*#__PURE__*/function (_Component) {
|
|
|
897
902
|
textOnly: textOnly || !render,
|
|
898
903
|
setScopeRow: setScopeRow,
|
|
899
904
|
mobileOptions: _objectSpread(_objectSpread({}, mobileOptions), {}, {
|
|
900
|
-
render: mobileOptions
|
|
901
|
-
header: mobileOptions
|
|
905
|
+
render: mobileOptions === null || mobileOptions === void 0 || (_mobileOptions$render = mobileOptions.render) === null || _mobileOptions$render === void 0 ? void 0 : _mobileOptions$render.call(mobileOptions, item),
|
|
906
|
+
header: (_mobileOptions$header = mobileOptions === null || mobileOptions === void 0 ? void 0 : mobileOptions.header) !== null && _mobileOptions$header !== void 0 ? _mobileOptions$header : name
|
|
902
907
|
})
|
|
903
|
-
}, cellProps, rest
|
|
908
|
+
}, cellProps, rest, {
|
|
909
|
+
append: this.renderCopyChar(columnIndex)
|
|
910
|
+
}), content);
|
|
904
911
|
}
|
|
905
912
|
}, {
|
|
906
913
|
key: "getRendererForDataType",
|
|
@@ -70,10 +70,7 @@ var EuiDataGridCellContent = /*#__PURE__*/(0, _react.memo)(function (_ref) {
|
|
|
70
70
|
});
|
|
71
71
|
}, [cellHeightType, isControlColumn]);
|
|
72
72
|
var styles = (0, _services.useEuiMemoizedStyles)(_data_grid_cell.euiDataGridRowCellStyles);
|
|
73
|
-
var cssStyles = [styles.content.euiDataGridRowCell__content].concat((0, _toConsumableArray2.default)(isControlColumn ? [
|
|
74
|
-
// Control column cells should not be vertically centered (defaultHeight) except
|
|
75
|
-
// on single rows. They should be top-aligned for auto and lineCount heights
|
|
76
|
-
styles.content.controlColumn, cellHeightType === 'default' ? styles.content.defaultHeight : styles.content.autoHeight] : [
|
|
73
|
+
var cssStyles = [styles.content.euiDataGridRowCell__content].concat((0, _toConsumableArray2.default)(isControlColumn ? [styles.content.controlColumn, styles.content.autoHeight] : [
|
|
77
74
|
// Regular data cells should always inherit height from the row wrapper,
|
|
78
75
|
// except for auto height
|
|
79
76
|
cellHeightType === 'auto' ? styles.content.autoHeight : styles.content.defaultHeight]));
|
|
@@ -151,7 +148,7 @@ var EuiDataGridCell = exports.EuiDataGridCell = /*#__PURE__*/function (_Componen
|
|
|
151
148
|
var lineCount = isSingleLine ? 1 : rowHeightUtils === null || rowHeightUtils === void 0 ? void 0 : rowHeightUtils.getLineCount(rowHeightOption);
|
|
152
149
|
if (lineCount) {
|
|
153
150
|
var shouldUseHeightsCache = rowHeightUtils === null || rowHeightUtils === void 0 ? void 0 : rowHeightUtils.isRowHeightOverride(rowIndex, rowHeightsOptions);
|
|
154
|
-
var height = rowHeightUtils.calculateHeightForLineCount(_this.cellContentsRef, lineCount
|
|
151
|
+
var height = rowHeightUtils.calculateHeightForLineCount(_this.cellContentsRef, lineCount);
|
|
155
152
|
if (shouldUseHeightsCache) {
|
|
156
153
|
var _this$props4 = _this.props,
|
|
157
154
|
columnId = _this$props4.columnId,
|
|
@@ -343,12 +340,12 @@ var EuiDataGridCell = exports.EuiDataGridCell = /*#__PURE__*/function (_Componen
|
|
|
343
340
|
}, {
|
|
344
341
|
key: "componentDidUpdate",
|
|
345
342
|
value: function componentDidUpdate(prevProps) {
|
|
346
|
-
var _this$props$rowHeight, _prevProps$rowHeights, _this$props$rowHeight2, _this$props$rowHeight3, _this$props$style, _prevProps$style;
|
|
343
|
+
var _this$props$rowHeight, _prevProps$rowHeights, _this$props$rowHeight2, _prevProps$rowHeights2, _this$props$rowHeight3, _prevProps$rowHeights3, _this$props$gridStyle, _prevProps$gridStyles, _this$props$gridStyle2, _prevProps$gridStyles2, _this$props$rowHeight4, _this$props$rowHeight5, _this$props$style, _prevProps$style;
|
|
347
344
|
this.recalculateAutoHeight();
|
|
348
|
-
if (((_this$props$rowHeight = this.props.rowHeightsOptions) === null || _this$props$rowHeight === void 0 ? void 0 : _this$props$rowHeight.defaultHeight) !== ((_prevProps$rowHeights = prevProps.rowHeightsOptions) === null || _prevProps$rowHeights === void 0 ? void 0 : _prevProps$rowHeights.defaultHeight)) {
|
|
345
|
+
if (((_this$props$rowHeight = this.props.rowHeightsOptions) === null || _this$props$rowHeight === void 0 ? void 0 : _this$props$rowHeight.defaultHeight) !== ((_prevProps$rowHeights = prevProps.rowHeightsOptions) === null || _prevProps$rowHeights === void 0 ? void 0 : _prevProps$rowHeights.defaultHeight) || ((_this$props$rowHeight2 = this.props.rowHeightsOptions) === null || _this$props$rowHeight2 === void 0 || (_this$props$rowHeight2 = _this$props$rowHeight2.rowHeights) === null || _this$props$rowHeight2 === void 0 ? void 0 : _this$props$rowHeight2[this.props.rowIndex]) !== ((_prevProps$rowHeights2 = prevProps.rowHeightsOptions) === null || _prevProps$rowHeights2 === void 0 || (_prevProps$rowHeights2 = _prevProps$rowHeights2.rowHeights) === null || _prevProps$rowHeights2 === void 0 ? void 0 : _prevProps$rowHeights2[prevProps.rowIndex]) || ((_this$props$rowHeight3 = this.props.rowHeightsOptions) === null || _this$props$rowHeight3 === void 0 ? void 0 : _this$props$rowHeight3.lineHeight) !== ((_prevProps$rowHeights3 = prevProps.rowHeightsOptions) === null || _prevProps$rowHeights3 === void 0 ? void 0 : _prevProps$rowHeights3.lineHeight) || ((_this$props$gridStyle = this.props.gridStyles) === null || _this$props$gridStyle === void 0 ? void 0 : _this$props$gridStyle.fontSize) !== ((_prevProps$gridStyles = prevProps.gridStyles) === null || _prevProps$gridStyles === void 0 ? void 0 : _prevProps$gridStyles.fontSize) || ((_this$props$gridStyle2 = this.props.gridStyles) === null || _this$props$gridStyle2 === void 0 ? void 0 : _this$props$gridStyle2.cellPadding) !== ((_prevProps$gridStyles2 = prevProps.gridStyles) === null || _prevProps$gridStyles2 === void 0 ? void 0 : _prevProps$gridStyles2.cellPadding)) {
|
|
349
346
|
this.recalculateLineHeight();
|
|
350
347
|
}
|
|
351
|
-
if ((_this$props$
|
|
348
|
+
if ((_this$props$rowHeight4 = this.props.rowHeightUtils) !== null && _this$props$rowHeight4 !== void 0 && _this$props$rowHeight4.compensateForLayoutShift && (_this$props$rowHeight5 = this.props.rowHeightsOptions) !== null && _this$props$rowHeight5 !== void 0 && _this$props$rowHeight5.scrollAnchorRow && this.props.colIndex === 0 &&
|
|
352
349
|
// once per row
|
|
353
350
|
this.props.columnId === prevProps.columnId &&
|
|
354
351
|
// if this is still the same column
|
|
@@ -356,12 +353,12 @@ var EuiDataGridCell = exports.EuiDataGridCell = /*#__PURE__*/function (_Componen
|
|
|
356
353
|
// if this is still the same row
|
|
357
354
|
((_this$props$style = this.props.style) === null || _this$props$style === void 0 ? void 0 : _this$props$style.top) !== ((_prevProps$style = prevProps.style) === null || _prevProps$style === void 0 ? void 0 : _prevProps$style.top) // if the top position has changed
|
|
358
355
|
) {
|
|
359
|
-
var _prevProps$style2, _this$props$style2, _this$props$
|
|
356
|
+
var _prevProps$style2, _this$props$style2, _this$props$rowHeight6;
|
|
360
357
|
var previousTop = parseFloat((_prevProps$style2 = prevProps.style) === null || _prevProps$style2 === void 0 ? void 0 : _prevProps$style2.top);
|
|
361
358
|
var currentTop = parseFloat((_this$props$style2 = this.props.style) === null || _this$props$style2 === void 0 ? void 0 : _this$props$style2.top);
|
|
362
359
|
|
|
363
360
|
// @ts-ignore We've already checked that this virtualization util is available above
|
|
364
|
-
this.props.rowHeightUtils.compensateForLayoutShift(this.props.rowIndex, currentTop - previousTop, (_this$props$
|
|
361
|
+
this.props.rowHeightUtils.compensateForLayoutShift(this.props.rowIndex, currentTop - previousTop, (_this$props$rowHeight6 = this.props.rowHeightsOptions) === null || _this$props$rowHeight6 === void 0 ? void 0 : _this$props$rowHeight6.scrollAnchorRow);
|
|
365
362
|
}
|
|
366
363
|
if (this.props.popoverContext.popoverIsOpen !== prevProps.popoverContext.popoverIsOpen || this.props.popoverContext.cellLocation !== prevProps.popoverContext.cellLocation || this.props.renderCellPopover !== prevProps.renderCellPopover) {
|
|
367
364
|
this.handleCellPopover();
|
|
@@ -373,6 +370,7 @@ var EuiDataGridCell = exports.EuiDataGridCell = /*#__PURE__*/function (_Componen
|
|
|
373
370
|
}, {
|
|
374
371
|
key: "shouldComponentUpdate",
|
|
375
372
|
value: function shouldComponentUpdate(nextProps, nextState) {
|
|
373
|
+
var _nextProps$gridStyles, _this$props$gridStyle3, _nextProps$gridStyles2, _this$props$gridStyle4;
|
|
376
374
|
if (nextProps.rowIndex !== this.props.rowIndex) return true;
|
|
377
375
|
if (nextProps.visibleRowIndex !== this.props.visibleRowIndex) return true;
|
|
378
376
|
if (nextProps.colIndex !== this.props.colIndex) return true;
|
|
@@ -380,6 +378,8 @@ var EuiDataGridCell = exports.EuiDataGridCell = /*#__PURE__*/function (_Componen
|
|
|
380
378
|
if (nextProps.columnType !== this.props.columnType) return true;
|
|
381
379
|
if (nextProps.width !== this.props.width) return true;
|
|
382
380
|
if (nextProps.rowHeightsOptions !== this.props.rowHeightsOptions) return true;
|
|
381
|
+
if (((_nextProps$gridStyles = nextProps.gridStyles) === null || _nextProps$gridStyles === void 0 ? void 0 : _nextProps$gridStyles.fontSize) !== ((_this$props$gridStyle3 = this.props.gridStyles) === null || _this$props$gridStyle3 === void 0 ? void 0 : _this$props$gridStyle3.fontSize)) return true;
|
|
382
|
+
if (((_nextProps$gridStyles2 = nextProps.gridStyles) === null || _nextProps$gridStyles2 === void 0 ? void 0 : _nextProps$gridStyles2.cellPadding) !== ((_this$props$gridStyle4 = this.props.gridStyles) === null || _this$props$gridStyle4 === void 0 ? void 0 : _this$props$gridStyle4.cellPadding)) return true;
|
|
383
383
|
if (nextProps.renderCellValue !== this.props.renderCellValue) return true;
|
|
384
384
|
if (nextProps.renderCellPopover !== this.props.renderCellPopover) return true;
|
|
385
385
|
if (nextProps.interactiveCellId !== this.props.interactiveCellId) return true;
|
|
@@ -425,6 +425,10 @@ var EuiDataGridCell = exports.EuiDataGridCell = /*#__PURE__*/function (_Componen
|
|
|
425
425
|
var popoverIsOpen = this.isPopoverOpen();
|
|
426
426
|
var showCellActions = isExpandable && (popoverIsOpen || this.state.isFocused || this.state.isHovered);
|
|
427
427
|
var cellClasses = (0, _classnames.default)('euiDataGridRowCell', (0, _defineProperty2.default)((0, _defineProperty2.default)({}, "euiDataGridRowCell--".concat(columnType), columnType), 'euiDataGridRowCell--open', popoverIsOpen), className);
|
|
428
|
+
|
|
429
|
+
// classNames set by EuiDataGridCellWrapper
|
|
430
|
+
var isControlColumn = cellClasses.includes('euiDataGridRowCell--controlColumn');
|
|
431
|
+
var isLastColumn = cellClasses.includes('euiDataGridRowCell--lastColumn');
|
|
428
432
|
var ariaRowIndex = pagination ? visibleRowIndex + 1 + pagination.pageSize * pagination.pageIndex : visibleRowIndex + 1;
|
|
429
433
|
var _this$state$cellProps2 = this.state.cellProps,
|
|
430
434
|
_ = _this$state$cellProps2.isExpandable,
|
|
@@ -478,10 +482,10 @@ var EuiDataGridCell = exports.EuiDataGridCell = /*#__PURE__*/function (_Componen
|
|
|
478
482
|
setCellContentsRef: this.setCellContentsRef,
|
|
479
483
|
rowHeight: rowHeight,
|
|
480
484
|
rowHeightUtils: rowHeightUtils,
|
|
481
|
-
isControlColumn:
|
|
485
|
+
isControlColumn: isControlColumn,
|
|
482
486
|
rowIndex: rowIndex,
|
|
483
487
|
colIndex: colIndex
|
|
484
|
-
}))), this.state.isFocused && (0, _react2.jsx)(CellScreenReaderDescription, {
|
|
488
|
+
}))), isLastColumn ? _services.tabularCopyMarkers.hiddenNewline : _services.tabularCopyMarkers.hiddenTab, this.state.isFocused && (0, _react2.jsx)(CellScreenReaderDescription, {
|
|
485
489
|
columnName: (column === null || column === void 0 ? void 0 : column.displayAsText) || this.props.columnId,
|
|
486
490
|
columnIndex: colIndex + 1,
|
|
487
491
|
rowIndex: ariaRowIndex,
|
|
@@ -559,6 +563,6 @@ var CellScreenReaderDescription = /*#__PURE__*/(0, _react.memo)(function (_ref5)
|
|
|
559
563
|
rowIndex: rowIndex
|
|
560
564
|
});
|
|
561
565
|
var enterKeyPrompt = (0, _i18n.useEuiI18n)('euiDataGridCell.expansionEnterPrompt', 'Press the Enter key to expand this cell.');
|
|
562
|
-
return (0, _react2.jsx)(_accessibility.EuiScreenReaderOnly, null, (0, _react2.jsx)("p", null, " - ".concat(cellPosition).concat(canExpandCell ? ". ".concat(enterKeyPrompt) : '')));
|
|
566
|
+
return (0, _react2.jsx)(_accessibility.EuiScreenReaderOnly, null, (0, _react2.jsx)("p", null, _services.tabularCopyMarkers.hiddenNoCopyBoundary, " - ".concat(cellPosition).concat(canExpandCell ? ". ".concat(enterKeyPrompt) : ''), _services.tabularCopyMarkers.hiddenNoCopyBoundary));
|
|
563
567
|
});
|
|
564
568
|
CellScreenReaderDescription.displayName = 'CellScreenReaderDescription';
|
|
@@ -96,6 +96,7 @@ var _ref = process.env.NODE_ENV === "production" ? {
|
|
|
96
96
|
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
97
97
|
};
|
|
98
98
|
var euiDataGridRowCellStyles = exports.euiDataGridRowCellStyles = function euiDataGridRowCellStyles(euiThemeContext) {
|
|
99
|
+
var euiTheme = euiThemeContext.euiTheme;
|
|
99
100
|
var cellOutline = euiDataGridCellOutlineStyles(euiThemeContext);
|
|
100
101
|
var _euiDataGridCellOutli = euiDataGridCellOutlineSelectors(),
|
|
101
102
|
outlineSelectors = _euiDataGridCellOutli.outline;
|
|
@@ -103,9 +104,11 @@ var euiDataGridRowCellStyles = exports.euiDataGridRowCellStyles = function euiDa
|
|
|
103
104
|
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;"),
|
|
104
105
|
content: {
|
|
105
106
|
euiDataGridRowCell__content: _ref,
|
|
106
|
-
controlColumn: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('max-height', '100%'), " display:flex;align-items:center;;label:controlColumn;"),
|
|
107
107
|
autoHeight: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('height', 'auto'), ";;label:autoHeight;"),
|
|
108
|
-
defaultHeight: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('height', '100%'), ";;label:defaultHeight;")
|
|
108
|
+
defaultHeight: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('height', '100%'), ";;label:defaultHeight;"),
|
|
109
|
+
// Control columns should be vertically centered with the *first line* of text
|
|
110
|
+
// for both single and multi-line heights (see https://github.com/elastic/eui/issues/7897)
|
|
111
|
+
controlColumn: /*#__PURE__*/(0, _react.css)("display:inline-flex;align-items:start;gap:", euiTheme.size.xxs, ";vertical-align:-webkit-baseline-middle;vertical-align:-moz-middle-with-baseline;.euiDataGrid--fontSizeSmall &:where(.euiDataGridRowCell__content--defaultHeight){", (0, _global_styling.logicalCSS)('height', '100%'), " align-items:center;}.euiCheckbox:not(:has(label)){display:inline;.euiCheckbox__square{display:inline-flex;vertical-align:text-bottom;@supports (vertical-align: -moz-middle-with-baseline){vertical-align:sub;}}};label:controlColumn;")
|
|
109
112
|
}
|
|
110
113
|
};
|
|
111
114
|
};
|
|
@@ -98,6 +98,7 @@ var EuiDataGridBodyCustomRender = exports.EuiDataGridBodyCustomRender = function
|
|
|
98
98
|
columnWidths: columnWidths,
|
|
99
99
|
defaultColumnWidth: defaultColumnWidth,
|
|
100
100
|
setColumnWidth: setColumnWidth,
|
|
101
|
+
visibleColCount: visibleColCount,
|
|
101
102
|
setVisibleColumns: setVisibleColumns,
|
|
102
103
|
switchColumnPos: switchColumnPos,
|
|
103
104
|
sorting: sorting,
|
|
@@ -111,6 +112,7 @@ var EuiDataGridBodyCustomRender = exports.EuiDataGridBodyCustomRender = function
|
|
|
111
112
|
renderCellPopover: renderCellPopover,
|
|
112
113
|
rowIndex: visibleRows.visibleRowCount,
|
|
113
114
|
visibleRowIndex: visibleRows.visibleRowCount,
|
|
115
|
+
visibleColCount: visibleColCount,
|
|
114
116
|
interactiveCellId: interactiveCellId,
|
|
115
117
|
leadingControlColumns: leadingControlColumns,
|
|
116
118
|
trailingControlColumns: trailingControlColumns,
|
|
@@ -142,9 +144,10 @@ var EuiDataGridBodyCustomRender = exports.EuiDataGridBodyCustomRender = function
|
|
|
142
144
|
interactiveCellId: interactiveCellId,
|
|
143
145
|
setRowHeight: setRowHeight,
|
|
144
146
|
rowHeightsOptions: rowHeightsOptions,
|
|
145
|
-
rowHeightUtils: rowHeightUtils
|
|
147
|
+
rowHeightUtils: rowHeightUtils,
|
|
148
|
+
gridStyles: gridStyles
|
|
146
149
|
};
|
|
147
|
-
}, [schema, schemaDetectors, pagination, columns, leadingControlColumns, trailingControlColumns, visibleColCount, columnWidths, defaultColumnWidth, renderCellValue, cellContext, renderCellPopover, interactiveCellId, setRowHeight, rowHeightsOptions, rowHeightUtils]);
|
|
150
|
+
}, [schema, schemaDetectors, pagination, columns, leadingControlColumns, trailingControlColumns, visibleColCount, columnWidths, defaultColumnWidth, renderCellValue, cellContext, renderCellPopover, interactiveCellId, setRowHeight, rowHeightsOptions, rowHeightUtils, gridStyles]);
|
|
148
151
|
var Cell = (0, _react.useCallback)(function (_ref2) {
|
|
149
152
|
var colIndex = _ref2.colIndex,
|
|
150
153
|
visibleRowIndex = _ref2.visibleRowIndex,
|
|
@@ -157,6 +157,7 @@ var EuiDataGridBodyVirtualized = exports.EuiDataGridBodyVirtualized = /*#__PURE_
|
|
|
157
157
|
columnWidths: columnWidths,
|
|
158
158
|
defaultColumnWidth: defaultColumnWidth,
|
|
159
159
|
setColumnWidth: setColumnWidth,
|
|
160
|
+
visibleColCount: visibleColCount,
|
|
160
161
|
setVisibleColumns: setVisibleColumns,
|
|
161
162
|
switchColumnPos: switchColumnPos,
|
|
162
163
|
sorting: sorting,
|
|
@@ -171,6 +172,7 @@ var EuiDataGridBodyVirtualized = exports.EuiDataGridBodyVirtualized = /*#__PURE_
|
|
|
171
172
|
renderCellPopover: renderCellPopover,
|
|
172
173
|
rowIndex: visibleRowCount,
|
|
173
174
|
visibleRowIndex: visibleRowCount,
|
|
175
|
+
visibleColCount: visibleColCount,
|
|
174
176
|
interactiveCellId: interactiveCellId,
|
|
175
177
|
leadingControlColumns: leadingControlColumns,
|
|
176
178
|
trailingControlColumns: trailingControlColumns,
|
|
@@ -293,9 +295,10 @@ var EuiDataGridBodyVirtualized = exports.EuiDataGridBodyVirtualized = /*#__PURE_
|
|
|
293
295
|
rowHeightUtils: rowHeightUtils,
|
|
294
296
|
rowManager: rowManager,
|
|
295
297
|
pagination: pagination,
|
|
296
|
-
headerRowHeight: headerRowHeight
|
|
298
|
+
headerRowHeight: headerRowHeight,
|
|
299
|
+
gridStyles: gridStyles
|
|
297
300
|
};
|
|
298
|
-
}, [schemaDetectors, setRowHeight, leadingControlColumns, trailingControlColumns, columns, visibleColCount, schema, columnWidths, defaultColumnWidth, renderCellValue, cellContext, renderCellPopover, interactiveCellId, rowHeightsOptions, rowHeightUtils, rowManager, pagination, headerRowHeight]);
|
|
301
|
+
}, [schemaDetectors, setRowHeight, leadingControlColumns, trailingControlColumns, columns, visibleColCount, schema, columnWidths, defaultColumnWidth, renderCellValue, cellContext, renderCellPopover, interactiveCellId, rowHeightsOptions, rowHeightUtils, rowManager, pagination, headerRowHeight, gridStyles]);
|
|
299
302
|
var rowWrapperContextValue = (0, _react.useMemo)(function () {
|
|
300
303
|
return {
|
|
301
304
|
headerRowHeight: headerRowHeight,
|
|
@@ -14,7 +14,7 @@ var _services = require("../../../../services");
|
|
|
14
14
|
var _cell = require("../cell");
|
|
15
15
|
var _data_grid_footer = require("./data_grid_footer.styles");
|
|
16
16
|
var _react2 = require("@emotion/react");
|
|
17
|
-
var _excluded = ["leadingControlColumns", "trailingControlColumns", "columns", "schema", "columnWidths", "defaultColumnWidth", "className", "renderCellValue", "renderCellPopover", "rowIndex", "interactiveCellId", "data-test-subj", "visibleRowIndex", "gridStyles"];
|
|
17
|
+
var _excluded = ["leadingControlColumns", "trailingControlColumns", "columns", "schema", "columnWidths", "defaultColumnWidth", "className", "renderCellValue", "renderCellPopover", "rowIndex", "interactiveCellId", "data-test-subj", "visibleRowIndex", "visibleColCount", "gridStyles"];
|
|
18
18
|
/*
|
|
19
19
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
20
20
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
@@ -42,19 +42,27 @@ var EuiDataGridFooterRow = exports.EuiDataGridFooterRow = /*#__PURE__*/(0, _reac
|
|
|
42
42
|
_dataTestSubj = _ref['data-test-subj'],
|
|
43
43
|
_ref$visibleRowIndex = _ref.visibleRowIndex,
|
|
44
44
|
visibleRowIndex = _ref$visibleRowIndex === void 0 ? rowIndex : _ref$visibleRowIndex,
|
|
45
|
+
visibleColCount = _ref.visibleColCount,
|
|
45
46
|
gridStyles = _ref.gridStyles,
|
|
46
47
|
rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
47
48
|
var styles = (0, _services.useEuiMemoizedStyles)(_data_grid_footer.euiDataGridFooterStyles);
|
|
48
49
|
var cssStyles = [styles.euiDataGridFooter, gridStyles.stickyFooter && styles.sticky, gridStyles.footer === 'striped' ? visibleRowIndex % 2 !== 0 && styles.striped : styles[gridStyles.footer]];
|
|
49
50
|
var classes = (0, _classnames.default)('euiDataGridFooter', className);
|
|
50
51
|
var dataTestSubj = (0, _classnames.default)('dataGridRow', 'dataGridFooterRow', _dataTestSubj);
|
|
52
|
+
var getCellClasses = (0, _react.useCallback)(function (columnIndex, classes) {
|
|
53
|
+
return (0, _classnames.default)('euiDataGridFooterCell', {
|
|
54
|
+
'euiDataGridRowCell--firstColumn': columnIndex === 0,
|
|
55
|
+
'euiDataGridRowCell--lastColumn': columnIndex === visibleColCount - 1
|
|
56
|
+
}, classes);
|
|
57
|
+
}, [visibleColCount]);
|
|
51
58
|
var popoverContext = (0, _react.useContext)(_cell.DataGridCellPopoverContext);
|
|
52
59
|
var sharedCellProps = {
|
|
53
60
|
css: styles.euiDataGridFooterCell,
|
|
54
61
|
rowIndex: rowIndex,
|
|
55
62
|
visibleRowIndex: visibleRowIndex,
|
|
56
63
|
interactiveCellId: interactiveCellId,
|
|
57
|
-
popoverContext: popoverContext
|
|
64
|
+
popoverContext: popoverContext,
|
|
65
|
+
gridStyles: gridStyles
|
|
58
66
|
};
|
|
59
67
|
return (0, _react2.jsx)("div", (0, _extends2.default)({
|
|
60
68
|
ref: ref,
|
|
@@ -74,7 +82,7 @@ var EuiDataGridFooterRow = exports.EuiDataGridFooterRow = /*#__PURE__*/(0, _reac
|
|
|
74
82
|
width: width,
|
|
75
83
|
renderCellValue: footerCellRender !== null && footerCellRender !== void 0 ? footerCellRender : renderEmpty,
|
|
76
84
|
isExpandable: false,
|
|
77
|
-
className: (0, _classnames.default)('
|
|
85
|
+
className: getCellClasses(i, (0, _classnames.default)('euiDataGridRowCell--controlColumn', footerCellProps === null || footerCellProps === void 0 ? void 0 : footerCellProps.className))
|
|
78
86
|
}));
|
|
79
87
|
}), columns.map(function (_ref3, i) {
|
|
80
88
|
var id = _ref3.id;
|
|
@@ -91,7 +99,7 @@ var EuiDataGridFooterRow = exports.EuiDataGridFooterRow = /*#__PURE__*/(0, _reac
|
|
|
91
99
|
renderCellValue: renderCellValue,
|
|
92
100
|
renderCellPopover: renderCellPopover,
|
|
93
101
|
isExpandable: true,
|
|
94
|
-
className:
|
|
102
|
+
className: getCellClasses(columnPosition)
|
|
95
103
|
}));
|
|
96
104
|
}), trailingControlColumns.map(function (_ref4, i) {
|
|
97
105
|
var id = _ref4.id,
|
|
@@ -106,7 +114,7 @@ var EuiDataGridFooterRow = exports.EuiDataGridFooterRow = /*#__PURE__*/(0, _reac
|
|
|
106
114
|
width: width,
|
|
107
115
|
renderCellValue: footerCellRender !== null && footerCellRender !== void 0 ? footerCellRender : renderEmpty,
|
|
108
116
|
isExpandable: false,
|
|
109
|
-
className: (0, _classnames.default)('
|
|
117
|
+
className: getCellClasses(colIndex, (0, _classnames.default)('euiDataGridRowCell--controlColumn', footerCellProps === null || footerCellProps === void 0 ? void 0 : footerCellProps.className))
|
|
110
118
|
}));
|
|
111
119
|
}));
|
|
112
120
|
}));
|